basistheory


Namebasistheory JSON
Version 3.0.0 PyPI version JSON
download
home_pagehttps://basistheory.com
SummaryBasisTheory Python SDK
upload_time2024-11-14 15:05:03
maintainerNone
docs_urlNone
authorBasis Theory
requires_python>=3.7
licenseNone
keywords basistheory basis theory sdk python
VCS
bugtrack_url
requirements No requirements were recorded.
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/f6/67/4ca9eff8f0acf9ebf42a61f26947229f5eca2c33734d4ff2257291bf7d14/basistheory-3.0.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": "3.0.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": "98edc5c56fc0b8c19128eb294fa461f0908e5005e41af790b466e038ac9e85c4",
                "md5": "0afcab4b610d5ed3f0e7fa9582e54379",
                "sha256": "702119c56d4067d2eedb38c2a4aade73eb272147a724491c80114afecb27ca9c"
            },
            "downloads": -1,
            "filename": "basistheory-3.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0afcab4b610d5ed3f0e7fa9582e54379",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 390077,
            "upload_time": "2024-11-14T15:05:02",
            "upload_time_iso_8601": "2024-11-14T15:05:02.027444Z",
            "url": "https://files.pythonhosted.org/packages/98/ed/c5c56fc0b8c19128eb294fa461f0908e5005e41af790b466e038ac9e85c4/basistheory-3.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f6674ca9eff8f0acf9ebf42a61f26947229f5eca2c33734d4ff2257291bf7d14",
                "md5": "ee68e68ab7a548c959c4c68635232543",
                "sha256": "4c55e8f5a63c07ec22ec3ac43a83dae729341c2dcdf8eae4e65fa9c9c0165466"
            },
            "downloads": -1,
            "filename": "basistheory-3.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "ee68e68ab7a548c959c4c68635232543",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 108616,
            "upload_time": "2024-11-14T15:05:03",
            "upload_time_iso_8601": "2024-11-14T15:05:03.628108Z",
            "url": "https://files.pythonhosted.org/packages/f6/67/4ca9eff8f0acf9ebf42a61f26947229f5eca2c33734d4ff2257291bf7d14/basistheory-3.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-14 15:05:03",
    "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": [],
    "tox": true,
    "lcname": "basistheory"
}
        
Elapsed time: 0.54051s