Skip to main content

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.cards.Type,  # The card type.
    memo=str,  # An optional card name.
    spend_limit=int,  # An optional spend limit (in pennies).
    spend_limit_duration=privacy.schema.cards.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.cards.States,  # 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.cards.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.embeds.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].

Metadata

Release files for privacy.py 2019.12.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for privacy.py 2019.12.11
File Size Uploaded
privacy.py-2019.12.11.tar.gz 14.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for privacy.py 2019.12.11
File Interpreter ABI Platform
privacy.py-2019.12.11-py3-none-any.whl Python 3 none any Details

Total release size: 33.2 kB

Release files / privacy.py-2019.12.11.tar.gz

Download URL privacy.py-2019.12.11.tar.gz
Size 14.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f85ebed2d826d2851be87d6425fb17651512609cbb656f9e5f336048da3ebb07
BLAKE2b-256 checksum
How to use checksums
7876c9175f5f42a510621f34b1dba3e59820f6767d5d5267bdd2e4d925b0c881
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.17 CPython/3.8.0 Linux/4.15.0-1028-gcp

Release files / privacy.py-2019.12.11-py3-none-any.whl

Download URL privacy.py-2019.12.11-py3-none-any.whl
Size 18.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
29b65c9351eb12c08b8588e6949210c4a612aae3cb28298b605ecdae2a4a8af3
BLAKE2b-256 checksum
How to use checksums
0846efd9e0e5d2cdbcb8b2226ad9e9ff3cb3787f1aafb11624fecd30647f47fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.17 CPython/3.8.0 Linux/4.15.0-1028-gcp

Release history Release notifications | RSS feed

This release

2019.12.11 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page