basistheory


Namebasistheory JSON
Version 2.2.0 PyPI version JSON
download
home_pagehttps://basistheory.com
SummaryBasisTheory Python SDK
upload_time2024-10-17 13:01:41
maintainerNone
docs_urlNone
authorBasis Theory
requires_python>=3.7
licenseNone
keywords basistheory basis theory sdk python
VCS
bugtrack_url
requirements python_dateutil setuptools urllib3 retrying pytest-env pytest
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Basis Theory Python SDK

[![Release](https://github.com/Basis-Theory/basistheory-python/actions/workflows/release.yml/badge.svg)](https://github.com/Basis-Theory/basistheory-python/actions/workflows/release.yml)

The [Basis Theory](https://basistheory.com/) Python SDK for Python >=3.7

## Installation
### pip install

From the git repository

```sh
pip install git+https://github.com/Basis-Theory/basistheory-python.git
```

(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/Basis-Theory/basistheory-python.git`)

Then import the package:

```python
import basistheory
```

### Setuptools

Install via [Setuptools](http://pypi.python.org/pypi/setuptools).

```sh
python setup.py install --user
```

(or `sudo python setup.py install` to install the package for all users)

Then import the package:

```python
import basistheory
```

### Locally
To install your latest changes locally run:

`python3 -m pip install .`

## Documentation

If you need any assistance, please contact support@basistheory.com at this time.

### Client Methods

All URIs are relative to *https://api.basistheory.com*

Class | Method | HTTP request
------------ | ------------- | -------------
*TokensApi* | [**create**](docs/TokensApi.md#create) | **POST** /tokens
*TokensApi* | [**delete**](docs/TokensApi.md#delete) | **DELETE** /tokens/{id}
*TokensApi* | [**get_by_id**](docs/TokensApi.md#get_by_id) | **GET** /tokens/{id}
*TokensApi* | [**list**](docs/TokensApi.md#list) | **GET** /tokens

### Models

- [EncryptionKey](docs/EncryptionKey.md)
- [EncryptionMetadata](docs/EncryptionMetadata.md)
- [PaginatedTokenList](docs/PaginatedTokenList.md)
- [Pagination](docs/Pagination.md)
- [Token](docs/Token.md)

## Usage

### Per-request configuration

All of the client methods accept an optional `RequestOptions` object.<br>This is
used if you want to set a [correlation ID](https://docs.basistheory.com/api-reference/?shell#request-correlation) or if you want to set a per-request [`BT-API-KEY`](https://docs.basistheory.com/api-reference/?shell#authentication)

```python
import uuid
import basistheory
from basistheory.request_options import RequestOptions

request_options = RequestOptions(api_key="API KEY", correlation_id=uuid.uuid4())
```

### Client Configuration

Each Api client can be configured to use a custom API url and client-wide [`BT-API-KEY`](https://docs.basistheory.com/api-reference/?shell#authentication).

```python
import basistheory
from basistheory.api import tokens_api

configuration = basistheory.Configuration(
    host = "https://token-proxy.somedomain.com",
    api_key = "API KEY"
)

with basistheory.ApiClient(configuration) as api_client:
    # Create a token client w/ global configuration for all requests
    token_client = tokens_api.TokensApi(api_client)
```

### Getting Started

Quick example creating a token and then retrieving it.

```python
import uuid
import basistheory
from pprint import pprint
from basistheory.api import tokens_api
from basistheory.model.create_token_request import CreateTokenRequest
from basistheory.request_options import RequestOptions

# Defining client wide api_key
configuration = basistheory.Configuration(
    api_key = "API KEY"
)

with basistheory.ApiClient(configuration) as api_client:
    # Create an instance of the tokens API client
    token_client = tokens_api.TokensApi(api_client)

    # Setting a correlation Id
    request_options = RequestOptions(correlation_id=uuid.uuid4().__str__())

    # Token request object
    request = CreateTokenRequest(type="token", data="My Secret Data")

    try:
        # Creating the token
        created_token = token_client.create(create_token_request=request, request_options=request_options)
        pprint(created_token)

        # Retrieving it (requires read permission on the token type classification and impact level)
        retrieved_token = token_client.get_by_id(id=created_token.id)
        pprint(retrieved_token)
    except basistheory.ApiException as e:
        print("Exception when calling TokensApi: %s\n" % e)
```




            

Raw data

            {
    "_id": null,
    "home_page": "https://basistheory.com",
    "name": "basistheory",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "BasisTheory, Basis Theory, SDK, Python",
    "author": "Basis Theory",
    "author_email": "support@basistheory.com",
    "download_url": "https://files.pythonhosted.org/packages/32/c3/0e5a16dc64e1ca11dfbec6cb005c61feb4d4dd57f3c5dad0a31fb0ce033c/basistheory-2.2.0.tar.gz",
    "platform": null,
    "description": "# Basis Theory Python SDK\n\n[![Release](https://github.com/Basis-Theory/basistheory-python/actions/workflows/release.yml/badge.svg)](https://github.com/Basis-Theory/basistheory-python/actions/workflows/release.yml)\n\nThe [Basis Theory](https://basistheory.com/) Python SDK for Python >=3.7\n\n## Installation\n### pip install\n\nFrom the git repository\n\n```sh\npip install git+https://github.com/Basis-Theory/basistheory-python.git\n```\n\n(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/Basis-Theory/basistheory-python.git`)\n\nThen import the package:\n\n```python\nimport basistheory\n```\n\n### Setuptools\n\nInstall via [Setuptools](http://pypi.python.org/pypi/setuptools).\n\n```sh\npython setup.py install --user\n```\n\n(or `sudo python setup.py install` to install the package for all users)\n\nThen import the package:\n\n```python\nimport basistheory\n```\n\n### Locally\nTo install your latest changes locally run:\n\n`python3 -m pip install .`\n\n## Documentation\n\nIf you need any assistance, please contact support@basistheory.com at this time.\n\n### Client Methods\n\nAll URIs are relative to *https://api.basistheory.com*\n\nClass | Method | HTTP request\n------------ | ------------- | -------------\n*TokensApi* | [**create**](docs/TokensApi.md#create) | **POST** /tokens\n*TokensApi* | [**delete**](docs/TokensApi.md#delete) | **DELETE** /tokens/{id}\n*TokensApi* | [**get_by_id**](docs/TokensApi.md#get_by_id) | **GET** /tokens/{id}\n*TokensApi* | [**list**](docs/TokensApi.md#list) | **GET** /tokens\n\n### Models\n\n- [EncryptionKey](docs/EncryptionKey.md)\n- [EncryptionMetadata](docs/EncryptionMetadata.md)\n- [PaginatedTokenList](docs/PaginatedTokenList.md)\n- [Pagination](docs/Pagination.md)\n- [Token](docs/Token.md)\n\n## Usage\n\n### Per-request configuration\n\nAll of the client methods accept an optional `RequestOptions` object.<br>This is\nused if you want to set a [correlation ID](https://docs.basistheory.com/api-reference/?shell#request-correlation) or if you want to set a per-request [`BT-API-KEY`](https://docs.basistheory.com/api-reference/?shell#authentication)\n\n```python\nimport uuid\nimport basistheory\nfrom basistheory.request_options import RequestOptions\n\nrequest_options = RequestOptions(api_key=\"API KEY\", correlation_id=uuid.uuid4())\n```\n\n### Client Configuration\n\nEach Api client can be configured to use a custom API url and client-wide [`BT-API-KEY`](https://docs.basistheory.com/api-reference/?shell#authentication).\n\n```python\nimport basistheory\nfrom basistheory.api import tokens_api\n\nconfiguration = basistheory.Configuration(\n    host = \"https://token-proxy.somedomain.com\",\n    api_key = \"API KEY\"\n)\n\nwith basistheory.ApiClient(configuration) as api_client:\n    # Create a token client w/ global configuration for all requests\n    token_client = tokens_api.TokensApi(api_client)\n```\n\n### Getting Started\n\nQuick example creating a token and then retrieving it.\n\n```python\nimport uuid\nimport basistheory\nfrom pprint import pprint\nfrom basistheory.api import tokens_api\nfrom basistheory.model.create_token_request import CreateTokenRequest\nfrom basistheory.request_options import RequestOptions\n\n# Defining client wide api_key\nconfiguration = basistheory.Configuration(\n    api_key = \"API KEY\"\n)\n\nwith basistheory.ApiClient(configuration) as api_client:\n    # Create an instance of the tokens API client\n    token_client = tokens_api.TokensApi(api_client)\n\n    # Setting a correlation Id\n    request_options = RequestOptions(correlation_id=uuid.uuid4().__str__())\n\n    # Token request object\n    request = CreateTokenRequest(type=\"token\", data=\"My Secret Data\")\n\n    try:\n        # Creating the token\n        created_token = token_client.create(create_token_request=request, request_options=request_options)\n        pprint(created_token)\n\n        # Retrieving it (requires read permission on the token type classification and impact level)\n        retrieved_token = token_client.get_by_id(id=created_token.id)\n        pprint(retrieved_token)\n    except basistheory.ApiException as e:\n        print(\"Exception when calling TokensApi: %s\\n\" % e)\n```\n\n\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "BasisTheory Python SDK",
    "version": "2.2.0",
    "project_urls": {
        "Documentation": "https://docs.basistheory.com/",
        "Homepage": "https://basistheory.com",
        "Source Code": "https://github.com/Basis-Theory/basistheory-python"
    },
    "split_keywords": [
        "basistheory",
        " basis theory",
        " sdk",
        " python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "332996e120a4c8719190ca715ae5242ca5673a6435e207491c52ea5d5f99d134",
                "md5": "c2055015866aa1900d1736b823acbb1b",
                "sha256": "9267e8b297abee7eacd2e219f610c3121fc0aa10bc05db5db9683a3f08e8f95a"
            },
            "downloads": -1,
            "filename": "basistheory-2.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c2055015866aa1900d1736b823acbb1b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 385171,
            "upload_time": "2024-10-17T13:01:39",
            "upload_time_iso_8601": "2024-10-17T13:01:39.961788Z",
            "url": "https://files.pythonhosted.org/packages/33/29/96e120a4c8719190ca715ae5242ca5673a6435e207491c52ea5d5f99d134/basistheory-2.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "32c30e5a16dc64e1ca11dfbec6cb005c61feb4d4dd57f3c5dad0a31fb0ce033c",
                "md5": "a603993b98e7510ceb2605f20c6e3ca8",
                "sha256": "e08bacdb9ca699c6215e1c2133f18cf23190d34560d8415044a2c1c406dbd301"
            },
            "downloads": -1,
            "filename": "basistheory-2.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a603993b98e7510ceb2605f20c6e3ca8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 107599,
            "upload_time": "2024-10-17T13:01:41",
            "upload_time_iso_8601": "2024-10-17T13:01:41.346627Z",
            "url": "https://files.pythonhosted.org/packages/32/c3/0e5a16dc64e1ca11dfbec6cb005c61feb4d4dd57f3c5dad0a31fb0ce033c/basistheory-2.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-17 13:01:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Basis-Theory",
    "github_project": "basistheory-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "python_dateutil",
            "specs": [
                [
                    ">=",
                    "2.5.3"
                ]
            ]
        },
        {
            "name": "setuptools",
            "specs": [
                [
                    ">=",
                    "21.0.0"
                ]
            ]
        },
        {
            "name": "urllib3",
            "specs": [
                [
                    ">=",
                    "1.25.3"
                ]
            ]
        },
        {
            "name": "retrying",
            "specs": []
        },
        {
            "name": "pytest-env",
            "specs": []
        },
        {
            "name": "pytest",
            "specs": []
        }
    ],
    "tox": true,
    "lcname": "basistheory"
}
        
Elapsed time: 0.36889s