Skip to main content

A Python lib for Privacy.com

Project description

Privacy.py

A Python wrapper for the Privacy API.

Installation

To install Privacy.py into your environment, simply run this:

pip install Privacy.py

Usage

Privacy's api has 3 groups of endpoints (which are differentiated by access): basic endpoints, premium endpoints and sandboxed endpoints.

Basic endpoints

These endpoints can be access by any account.

import privacy

client = privacy.Client("api-key")  # This supports `with privacy.Client("api-key") as client:`

# Returns an iterator of the cards available to your account (based on optional args).
iter_cards = client.cards_list(
    token=str,  # The token of a specific card (will still return an iterator of either 1 or 0 object(s)).
    begin="YYYY-MM-DD",  # Used to get cards that were created after the specified date.
    end="YYYY-MM-DD",  # Used to get cards that were created before the specified date.
)

# Returns an iterator of the transactions related to your account (based on optional args).
iter_transactions = client.transactions_list(
    approval_status="all",  # Used to only get transactions with a specific status.
                            # Can be `approvals`, `declines` or `all` and defaults to `all`.
    token=str,  # Used to get a specific transaction (will still return an iterator if passed).
    card_token=str,  # Used to get transactions related to a specific card.
    begin="YYYY-MM-DD",   # Used to get transactions that were created after the specified date.
    end="YYYY-MM-DD",  # Used to get transactions that were created before the specified date.
)
# With this being mirrored by the following function on the Card object.
iter_transactions = Card.get_transactions(*, **)  # Where card_token is from card this is attached to.

Premium endpoints.

These endpoints can only be accessed by premium accounts.

# Used to create a card.
card = client.cards_create(
    card_type=privacy.schema.card.Type,  # The card type.
    memo=str,  # An optional card name.
    spend_limit=int,  # An optional spend limit (in pennies).
    spend_limit_duration=privacy.schema.card.SpendLimitDuration,  # Optional, used to set how long the spend limit lasts.
)

# Used to modify a card based on it's token and optional args.
card = client.cards_modify(
    token=str,  # The token of the card being modified.
    state=privacy.schema.CardStates,  # Used to change the state of the card (cannot be reversed when set to `CLOSED`).
    memo=str,  # Used to change the name of the card.
    spend_limit=int,  # Used to change spend limit for the card (in pennies).
    spend_limit_duration=privacy.schema.card.SpendLimitDuration,  # Used to change how long the spend limit lasts.
)
# With this being mirrored by the following function on the Card object.
card.update(*, **)  # Where the token used is from the card this is attached to.

# Used to get a hosted card UI.
client.hoisted_card_ui_get(
    embed_request=privacy.schema.embed.EmbedRequest,  # An embed request object.
)

Sandboxed endponts

The endpoints can only be accessed on Privacy's separate sandboxed api (switched to by passing sandboxed=True through to privacy.Client.__init__).

  • Any changes made on these endpoints won't effect Privacy's actual service as these exist purely for debugging purposes.

  • These endpoints can be accessed using client.[auth_simulate, void_simulate, clearing_simulate, return_simulate].

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

privacy.py-2019.12.1.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

privacy.py-2019.12.1-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file privacy.py-2019.12.1.tar.gz.

File metadata

  • Download URL: privacy.py-2019.12.1.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.17 CPython/3.8.0 Linux/4.15.0-1028-gcp

File hashes

Hashes for privacy.py-2019.12.1.tar.gz
Algorithm Hash digest
SHA256 f03570c802c9af895eb14aa73d4d0ea8a2e495e3e6928422b731150fab8cb9d5
MD5 4d2c390f1531406cbb59ab8ed66cc8a4
BLAKE2b-256 631ff6ff1867ba2efcc71b8ef83a2f97d039f086d9cb3ef0695c1bfd3aa977ab

See more details on using hashes here.

File details

Details for the file privacy.py-2019.12.1-py3-none-any.whl.

File metadata

  • Download URL: privacy.py-2019.12.1-py3-none-any.whl
  • Upload date:
  • Size: 18.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.17 CPython/3.8.0 Linux/4.15.0-1028-gcp

File hashes

Hashes for privacy.py-2019.12.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a6492df8f0e13026036877d4331d6ec058876b61bff54b4beffeb991453ecbf0
MD5 d9806c4ccb45f0c097579f5b596c02bc
BLAKE2b-256 e7a44c571cecb3944d6d46101dbef6d8e03e33872fdb29f5e38680ed5c9b7de3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page