BasisTheoryClient 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- basistheoryclient-0.1.1/PKG-INFO +180 -0
- basistheoryclient-0.1.1/README.md +152 -0
- basistheoryclient-0.1.1/pyproject.toml +61 -0
- basistheoryclient-0.1.1/src/basis_theory/__init__.py +226 -0
- basistheoryclient-0.1.1/src/basis_theory/application_keys/__init__.py +2 -0
- basistheoryclient-0.1.1/src/basis_theory/application_keys/client.py +702 -0
- basistheoryclient-0.1.1/src/basis_theory/application_templates/__init__.py +2 -0
- basistheoryclient-0.1.1/src/basis_theory/application_templates/client.py +290 -0
- basistheoryclient-0.1.1/src/basis_theory/applications/__init__.py +2 -0
- basistheoryclient-0.1.1/src/basis_theory/applications/client.py +1360 -0
- basistheoryclient-0.1.1/src/basis_theory/client.py +198 -0
- basistheoryclient-0.1.1/src/basis_theory/core/__init__.py +50 -0
- basistheoryclient-0.1.1/src/basis_theory/core/api_error.py +15 -0
- basistheoryclient-0.1.1/src/basis_theory/core/client_wrapper.py +54 -0
- basistheoryclient-0.1.1/src/basis_theory/core/datetime_utils.py +28 -0
- basistheoryclient-0.1.1/src/basis_theory/core/file.py +62 -0
- basistheoryclient-0.1.1/src/basis_theory/core/http_client.py +481 -0
- basistheoryclient-0.1.1/src/basis_theory/core/jsonable_encoder.py +101 -0
- basistheoryclient-0.1.1/src/basis_theory/core/pagination.py +88 -0
- basistheoryclient-0.1.1/src/basis_theory/core/pydantic_utilities.py +273 -0
- basistheoryclient-0.1.1/src/basis_theory/core/query_encoder.py +58 -0
- basistheoryclient-0.1.1/src/basis_theory/core/remove_none_from_dict.py +11 -0
- basistheoryclient-0.1.1/src/basis_theory/core/request_options.py +32 -0
- basistheoryclient-0.1.1/src/basis_theory/core/serialization.py +272 -0
- basistheoryclient-0.1.1/src/basis_theory/environment.py +7 -0
- basistheoryclient-0.1.1/src/basis_theory/errors/__init__.py +17 -0
- basistheoryclient-0.1.1/src/basis_theory/errors/bad_request_error.py +9 -0
- basistheoryclient-0.1.1/src/basis_theory/errors/conflict_error.py +9 -0
- basistheoryclient-0.1.1/src/basis_theory/errors/forbidden_error.py +9 -0
- basistheoryclient-0.1.1/src/basis_theory/errors/not_found_error.py +9 -0
- basistheoryclient-0.1.1/src/basis_theory/errors/unauthorized_error.py +9 -0
- basistheoryclient-0.1.1/src/basis_theory/errors/unprocessable_entity_error.py +9 -0
- basistheoryclient-0.1.1/src/basis_theory/logs/__init__.py +2 -0
- basistheoryclient-0.1.1/src/basis_theory/logs/client.py +417 -0
- basistheoryclient-0.1.1/src/basis_theory/permissions/__init__.py +2 -0
- basistheoryclient-0.1.1/src/basis_theory/permissions/client.py +187 -0
- basistheoryclient-0.1.1/src/basis_theory/proxies/__init__.py +2 -0
- basistheoryclient-0.1.1/src/basis_theory/proxies/client.py +1382 -0
- basistheoryclient-0.1.1/src/basis_theory/py.typed +0 -0
- basistheoryclient-0.1.1/src/basis_theory/reactorformulas/__init__.py +2 -0
- basistheoryclient-0.1.1/src/basis_theory/reactorformulas/client.py +1090 -0
- basistheoryclient-0.1.1/src/basis_theory/reactors/__init__.py +5 -0
- basistheoryclient-0.1.1/src/basis_theory/reactors/client.py +1707 -0
- basistheoryclient-0.1.1/src/basis_theory/reactors/results/__init__.py +2 -0
- basistheoryclient-0.1.1/src/basis_theory/reactors/results/client.py +211 -0
- basistheoryclient-0.1.1/src/basis_theory/roles/__init__.py +2 -0
- basistheoryclient-0.1.1/src/basis_theory/roles/client.py +151 -0
- basistheoryclient-0.1.1/src/basis_theory/sessions/__init__.py +2 -0
- basistheoryclient-0.1.1/src/basis_theory/sessions/client.py +434 -0
- basistheoryclient-0.1.1/src/basis_theory/tenants/__init__.py +5 -0
- basistheoryclient-0.1.1/src/basis_theory/tenants/client.py +30 -0
- basistheoryclient-0.1.1/src/basis_theory/tenants/connections/__init__.py +2 -0
- basistheoryclient-0.1.1/src/basis_theory/tenants/connections/client.py +381 -0
- basistheoryclient-0.1.1/src/basis_theory/tenants/invitations/__init__.py +2 -0
- basistheoryclient-0.1.1/src/basis_theory/tenants/invitations/client.py +752 -0
- basistheoryclient-0.1.1/src/basis_theory/tenants/members/__init__.py +2 -0
- basistheoryclient-0.1.1/src/basis_theory/tenants/members/client.py +558 -0
- basistheoryclient-0.1.1/src/basis_theory/tenants/self_/__init__.py +2 -0
- basistheoryclient-0.1.1/src/basis_theory/tenants/self_/client.py +674 -0
- basistheoryclient-0.1.1/src/basis_theory/threeds/__init__.py +2 -0
- basistheoryclient-0.1.1/src/basis_theory/threeds/client.py +615 -0
- basistheoryclient-0.1.1/src/basis_theory/tokens/__init__.py +2 -0
- basistheoryclient-0.1.1/src/basis_theory/tokens/client.py +2226 -0
- basistheoryclient-0.1.1/src/basis_theory/types/__init__.py +173 -0
- basistheoryclient-0.1.1/src/basis_theory/types/access_rule.py +25 -0
- basistheoryclient-0.1.1/src/basis_theory/types/application.py +34 -0
- basistheoryclient-0.1.1/src/basis_theory/types/application_key.py +24 -0
- basistheoryclient-0.1.1/src/basis_theory/types/application_paginated_list.py +22 -0
- basistheoryclient-0.1.1/src/basis_theory/types/application_template.py +27 -0
- basistheoryclient-0.1.1/src/basis_theory/types/bin_details.py +41 -0
- basistheoryclient-0.1.1/src/basis_theory/types/bin_details_bank.py +22 -0
- basistheoryclient-0.1.1/src/basis_theory/types/bin_details_country.py +21 -0
- basistheoryclient-0.1.1/src/basis_theory/types/bin_details_product.py +20 -0
- basistheoryclient-0.1.1/src/basis_theory/types/card_details.py +20 -0
- basistheoryclient-0.1.1/src/basis_theory/types/condition.py +21 -0
- basistheoryclient-0.1.1/src/basis_theory/types/create_session_response.py +22 -0
- basistheoryclient-0.1.1/src/basis_theory/types/create_tenant_connection_response.py +19 -0
- basistheoryclient-0.1.1/src/basis_theory/types/cursor_pagination.py +20 -0
- basistheoryclient-0.1.1/src/basis_theory/types/event_types.py +5 -0
- basistheoryclient-0.1.1/src/basis_theory/types/get_applications.py +23 -0
- basistheoryclient-0.1.1/src/basis_theory/types/get_logs.py +26 -0
- basistheoryclient-0.1.1/src/basis_theory/types/get_permissions.py +19 -0
- basistheoryclient-0.1.1/src/basis_theory/types/get_proxies.py +23 -0
- basistheoryclient-0.1.1/src/basis_theory/types/get_reactor_formulas.py +22 -0
- basistheoryclient-0.1.1/src/basis_theory/types/get_reactors.py +23 -0
- basistheoryclient-0.1.1/src/basis_theory/types/get_tenant_invitations.py +23 -0
- basistheoryclient-0.1.1/src/basis_theory/types/get_tenant_members.py +22 -0
- basistheoryclient-0.1.1/src/basis_theory/types/get_tokens.py +23 -0
- basistheoryclient-0.1.1/src/basis_theory/types/get_tokens_v2.py +20 -0
- basistheoryclient-0.1.1/src/basis_theory/types/log.py +28 -0
- basistheoryclient-0.1.1/src/basis_theory/types/log_entity_type.py +20 -0
- basistheoryclient-0.1.1/src/basis_theory/types/log_paginated_list.py +22 -0
- basistheoryclient-0.1.1/src/basis_theory/types/pagination.py +24 -0
- basistheoryclient-0.1.1/src/basis_theory/types/permission.py +21 -0
- basistheoryclient-0.1.1/src/basis_theory/types/privacy.py +21 -0
- basistheoryclient-0.1.1/src/basis_theory/types/problem_details.py +23 -0
- basistheoryclient-0.1.1/src/basis_theory/types/proxy.py +37 -0
- basistheoryclient-0.1.1/src/basis_theory/types/proxy_paginated_list.py +22 -0
- basistheoryclient-0.1.1/src/basis_theory/types/proxy_transform.py +23 -0
- basistheoryclient-0.1.1/src/basis_theory/types/public_key.py +3 -0
- basistheoryclient-0.1.1/src/basis_theory/types/react_response.py +22 -0
- basistheoryclient-0.1.1/src/basis_theory/types/reactor.py +32 -0
- basistheoryclient-0.1.1/src/basis_theory/types/reactor_formula.py +34 -0
- basistheoryclient-0.1.1/src/basis_theory/types/reactor_formula_configuration.py +21 -0
- basistheoryclient-0.1.1/src/basis_theory/types/reactor_formula_paginated_list.py +22 -0
- basistheoryclient-0.1.1/src/basis_theory/types/reactor_formula_request_parameter.py +22 -0
- basistheoryclient-0.1.1/src/basis_theory/types/reactor_paginated_list.py +22 -0
- basistheoryclient-0.1.1/src/basis_theory/types/role.py +19 -0
- basistheoryclient-0.1.1/src/basis_theory/types/string_string_key_value_pair.py +20 -0
- basistheoryclient-0.1.1/src/basis_theory/types/tenant.py +28 -0
- basistheoryclient-0.1.1/src/basis_theory/types/tenant_connection_options.py +19 -0
- basistheoryclient-0.1.1/src/basis_theory/types/tenant_invitation_response.py +30 -0
- basistheoryclient-0.1.1/src/basis_theory/types/tenant_invitation_response_paginated_list.py +22 -0
- basistheoryclient-0.1.1/src/basis_theory/types/tenant_invitation_status.py +5 -0
- basistheoryclient-0.1.1/src/basis_theory/types/tenant_member_response.py +28 -0
- basistheoryclient-0.1.1/src/basis_theory/types/tenant_member_response_paginated_list.py +22 -0
- basistheoryclient-0.1.1/src/basis_theory/types/tenant_usage_report.py +20 -0
- basistheoryclient-0.1.1/src/basis_theory/types/three_ds_acs_rendering_type.py +22 -0
- basistheoryclient-0.1.1/src/basis_theory/types/three_ds_address.py +25 -0
- basistheoryclient-0.1.1/src/basis_theory/types/three_ds_authentication.py +44 -0
- basistheoryclient-0.1.1/src/basis_theory/types/three_ds_cardholder_account_info.py +33 -0
- basistheoryclient-0.1.1/src/basis_theory/types/three_ds_cardholder_authentication_info.py +21 -0
- basistheoryclient-0.1.1/src/basis_theory/types/three_ds_cardholder_info.py +36 -0
- basistheoryclient-0.1.1/src/basis_theory/types/three_ds_cardholder_phone_number.py +20 -0
- basistheoryclient-0.1.1/src/basis_theory/types/three_ds_device_info.py +36 -0
- basistheoryclient-0.1.1/src/basis_theory/types/three_ds_merchant_info.py +25 -0
- basistheoryclient-0.1.1/src/basis_theory/types/three_ds_merchant_risk_info.py +27 -0
- basistheoryclient-0.1.1/src/basis_theory/types/three_ds_message_extension.py +22 -0
- basistheoryclient-0.1.1/src/basis_theory/types/three_ds_method.py +20 -0
- basistheoryclient-0.1.1/src/basis_theory/types/three_ds_mobile_sdk_render_options.py +20 -0
- basistheoryclient-0.1.1/src/basis_theory/types/three_ds_prior_authentication_info.py +22 -0
- basistheoryclient-0.1.1/src/basis_theory/types/three_ds_purchase_info.py +26 -0
- basistheoryclient-0.1.1/src/basis_theory/types/three_ds_requestor_info.py +21 -0
- basistheoryclient-0.1.1/src/basis_theory/types/three_ds_session.py +37 -0
- basistheoryclient-0.1.1/src/basis_theory/types/three_ds_version.py +25 -0
- basistheoryclient-0.1.1/src/basis_theory/types/token.py +39 -0
- basistheoryclient-0.1.1/src/basis_theory/types/token_cursor_paginated_list.py +22 -0
- basistheoryclient-0.1.1/src/basis_theory/types/token_enrichments.py +22 -0
- basistheoryclient-0.1.1/src/basis_theory/types/token_metrics.py +21 -0
- basistheoryclient-0.1.1/src/basis_theory/types/token_paginated_list.py +22 -0
- basistheoryclient-0.1.1/src/basis_theory/types/token_report.py +23 -0
- basistheoryclient-0.1.1/src/basis_theory/types/update_privacy.py +20 -0
- basistheoryclient-0.1.1/src/basis_theory/types/user.py +25 -0
- basistheoryclient-0.1.1/src/basis_theory/types/validation_problem_details.py +24 -0
- basistheoryclient-0.1.1/src/basis_theory/types/webhook.py +30 -0
- basistheoryclient-0.1.1/src/basis_theory/types/webhook_list.py +22 -0
- basistheoryclient-0.1.1/src/basis_theory/types/webhook_list_pagination.py +20 -0
- basistheoryclient-0.1.1/src/basis_theory/types/webhook_status.py +5 -0
- basistheoryclient-0.1.1/src/basis_theory/version.py +3 -0
- basistheoryclient-0.1.1/src/basis_theory/webhooks/__init__.py +5 -0
- basistheoryclient-0.1.1/src/basis_theory/webhooks/client.py +1053 -0
- basistheoryclient-0.1.1/src/basis_theory/webhooks/events/__init__.py +2 -0
- basistheoryclient-0.1.1/src/basis_theory/webhooks/events/client.py +155 -0
- basistheoryclient-0.1.1/src/basis_theory/webhooks/signing_key/__init__.py +2 -0
- basistheoryclient-0.1.1/src/basis_theory/webhooks/signing_key/client.py +98 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: BasisTheoryClient
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary:
|
|
5
|
+
Requires-Python: >=3.8,<4.0
|
|
6
|
+
Classifier: Intended Audience :: Developers
|
|
7
|
+
Classifier: Operating System :: MacOS
|
|
8
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Operating System :: POSIX
|
|
11
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Dist: httpx (>=0.21.2)
|
|
23
|
+
Requires-Dist: pydantic (>=1.9.2)
|
|
24
|
+
Requires-Dist: pydantic-core (>=2.18.2,<3.0.0)
|
|
25
|
+
Requires-Dist: typing_extensions (>=4.0.0)
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# BasisTheory Python Library
|
|
29
|
+
|
|
30
|
+
[](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2FBasis-Theory%2Fpython-sdk)
|
|
31
|
+
[](https://pypi.python.org/pypi/BasisTheoryClient)
|
|
32
|
+
|
|
33
|
+
The BasisTheory Python library provides convenient access to the BasisTheory API from Python.
|
|
34
|
+
|
|
35
|
+
## Documentation
|
|
36
|
+
|
|
37
|
+
API reference documentation is available [here](https://api.basistheory.com).
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
pip install BasisTheoryClient
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Usage
|
|
46
|
+
|
|
47
|
+
Instantiate and use the client with the following:
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
from basis_theory import BasisTheory
|
|
51
|
+
|
|
52
|
+
client = BasisTheory(
|
|
53
|
+
api_key="YOUR_API_KEY",
|
|
54
|
+
)
|
|
55
|
+
client.tenants.self_.get()
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Async Client
|
|
59
|
+
|
|
60
|
+
The SDK also exports an `async` client so that you can make non-blocking calls to our API.
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
import asyncio
|
|
64
|
+
|
|
65
|
+
from basis_theory import AsyncBasisTheory
|
|
66
|
+
|
|
67
|
+
client = AsyncBasisTheory(
|
|
68
|
+
api_key="YOUR_API_KEY",
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
async def main() -> None:
|
|
73
|
+
await client.tenants.self_.get()
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
asyncio.run(main())
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Exception Handling
|
|
80
|
+
|
|
81
|
+
When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
|
|
82
|
+
will be thrown.
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
from basis_theory.core.api_error import ApiError
|
|
86
|
+
|
|
87
|
+
try:
|
|
88
|
+
client.tenants.self_.get(...)
|
|
89
|
+
except ApiError as e:
|
|
90
|
+
print(e.status_code)
|
|
91
|
+
print(e.body)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Pagination
|
|
95
|
+
|
|
96
|
+
Paginated requests will return a `SyncPager` or `AsyncPager`, which can be used as generators for the underlying object.
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
from basis_theory import BasisTheory
|
|
100
|
+
|
|
101
|
+
client = BasisTheory(
|
|
102
|
+
api_key="YOUR_API_KEY",
|
|
103
|
+
)
|
|
104
|
+
response = client.applications.list()
|
|
105
|
+
for item in response:
|
|
106
|
+
yield item
|
|
107
|
+
# alternatively, you can paginate page-by-page
|
|
108
|
+
for page in response.iter_pages():
|
|
109
|
+
yield page
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Advanced
|
|
113
|
+
|
|
114
|
+
### Retries
|
|
115
|
+
|
|
116
|
+
The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
|
|
117
|
+
as the request is deemed retriable and the number of retry attempts has not grown larger than the configured
|
|
118
|
+
retry limit (default: 2).
|
|
119
|
+
|
|
120
|
+
A request is deemed retriable when any of the following HTTP status codes is returned:
|
|
121
|
+
|
|
122
|
+
- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
|
|
123
|
+
- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
|
|
124
|
+
- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
|
|
125
|
+
|
|
126
|
+
Use the `max_retries` request option to configure this behavior.
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
client.tenants.self_.get(..., {
|
|
130
|
+
"max_retries": 1
|
|
131
|
+
})
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Timeouts
|
|
135
|
+
|
|
136
|
+
The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
|
|
140
|
+
from basis_theory import BasisTheory
|
|
141
|
+
|
|
142
|
+
client = BasisTheory(
|
|
143
|
+
...,
|
|
144
|
+
timeout=20.0,
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
# Override timeout for a specific method
|
|
149
|
+
client.tenants.self_.get(..., {
|
|
150
|
+
"timeout_in_seconds": 1
|
|
151
|
+
})
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Custom Client
|
|
155
|
+
|
|
156
|
+
You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
|
|
157
|
+
and transports.
|
|
158
|
+
```python
|
|
159
|
+
import httpx
|
|
160
|
+
from basis_theory import BasisTheory
|
|
161
|
+
|
|
162
|
+
client = BasisTheory(
|
|
163
|
+
...,
|
|
164
|
+
httpx_client=httpx.Client(
|
|
165
|
+
proxies="http://my.test.proxy.example.com",
|
|
166
|
+
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
|
|
167
|
+
),
|
|
168
|
+
)
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Contributing
|
|
172
|
+
|
|
173
|
+
While we value open-source contributions to this SDK, this library is generated programmatically.
|
|
174
|
+
Additions made directly to this library would have to be moved over to our generation code,
|
|
175
|
+
otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
|
|
176
|
+
a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
|
|
177
|
+
an issue first to discuss with us!
|
|
178
|
+
|
|
179
|
+
On the other hand, contributions to the README are always very welcome!
|
|
180
|
+
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# BasisTheory Python Library
|
|
2
|
+
|
|
3
|
+
[](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2FBasis-Theory%2Fpython-sdk)
|
|
4
|
+
[](https://pypi.python.org/pypi/BasisTheoryClient)
|
|
5
|
+
|
|
6
|
+
The BasisTheory Python library provides convenient access to the BasisTheory API from Python.
|
|
7
|
+
|
|
8
|
+
## Documentation
|
|
9
|
+
|
|
10
|
+
API reference documentation is available [here](https://api.basistheory.com).
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
pip install BasisTheoryClient
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
Instantiate and use the client with the following:
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
from basis_theory import BasisTheory
|
|
24
|
+
|
|
25
|
+
client = BasisTheory(
|
|
26
|
+
api_key="YOUR_API_KEY",
|
|
27
|
+
)
|
|
28
|
+
client.tenants.self_.get()
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Async Client
|
|
32
|
+
|
|
33
|
+
The SDK also exports an `async` client so that you can make non-blocking calls to our API.
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
import asyncio
|
|
37
|
+
|
|
38
|
+
from basis_theory import AsyncBasisTheory
|
|
39
|
+
|
|
40
|
+
client = AsyncBasisTheory(
|
|
41
|
+
api_key="YOUR_API_KEY",
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
async def main() -> None:
|
|
46
|
+
await client.tenants.self_.get()
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
asyncio.run(main())
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Exception Handling
|
|
53
|
+
|
|
54
|
+
When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
|
|
55
|
+
will be thrown.
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from basis_theory.core.api_error import ApiError
|
|
59
|
+
|
|
60
|
+
try:
|
|
61
|
+
client.tenants.self_.get(...)
|
|
62
|
+
except ApiError as e:
|
|
63
|
+
print(e.status_code)
|
|
64
|
+
print(e.body)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Pagination
|
|
68
|
+
|
|
69
|
+
Paginated requests will return a `SyncPager` or `AsyncPager`, which can be used as generators for the underlying object.
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from basis_theory import BasisTheory
|
|
73
|
+
|
|
74
|
+
client = BasisTheory(
|
|
75
|
+
api_key="YOUR_API_KEY",
|
|
76
|
+
)
|
|
77
|
+
response = client.applications.list()
|
|
78
|
+
for item in response:
|
|
79
|
+
yield item
|
|
80
|
+
# alternatively, you can paginate page-by-page
|
|
81
|
+
for page in response.iter_pages():
|
|
82
|
+
yield page
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Advanced
|
|
86
|
+
|
|
87
|
+
### Retries
|
|
88
|
+
|
|
89
|
+
The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
|
|
90
|
+
as the request is deemed retriable and the number of retry attempts has not grown larger than the configured
|
|
91
|
+
retry limit (default: 2).
|
|
92
|
+
|
|
93
|
+
A request is deemed retriable when any of the following HTTP status codes is returned:
|
|
94
|
+
|
|
95
|
+
- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
|
|
96
|
+
- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
|
|
97
|
+
- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
|
|
98
|
+
|
|
99
|
+
Use the `max_retries` request option to configure this behavior.
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
client.tenants.self_.get(..., {
|
|
103
|
+
"max_retries": 1
|
|
104
|
+
})
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Timeouts
|
|
108
|
+
|
|
109
|
+
The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
|
|
113
|
+
from basis_theory import BasisTheory
|
|
114
|
+
|
|
115
|
+
client = BasisTheory(
|
|
116
|
+
...,
|
|
117
|
+
timeout=20.0,
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
# Override timeout for a specific method
|
|
122
|
+
client.tenants.self_.get(..., {
|
|
123
|
+
"timeout_in_seconds": 1
|
|
124
|
+
})
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Custom Client
|
|
128
|
+
|
|
129
|
+
You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
|
|
130
|
+
and transports.
|
|
131
|
+
```python
|
|
132
|
+
import httpx
|
|
133
|
+
from basis_theory import BasisTheory
|
|
134
|
+
|
|
135
|
+
client = BasisTheory(
|
|
136
|
+
...,
|
|
137
|
+
httpx_client=httpx.Client(
|
|
138
|
+
proxies="http://my.test.proxy.example.com",
|
|
139
|
+
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
|
|
140
|
+
),
|
|
141
|
+
)
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Contributing
|
|
145
|
+
|
|
146
|
+
While we value open-source contributions to this SDK, this library is generated programmatically.
|
|
147
|
+
Additions made directly to this library would have to be moved over to our generation code,
|
|
148
|
+
otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
|
|
149
|
+
a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
|
|
150
|
+
an issue first to discuss with us!
|
|
151
|
+
|
|
152
|
+
On the other hand, contributions to the README are always very welcome!
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "BasisTheoryClient"
|
|
3
|
+
version = "0.1.1"
|
|
4
|
+
description = ""
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
authors = []
|
|
7
|
+
keywords = []
|
|
8
|
+
|
|
9
|
+
classifiers = [
|
|
10
|
+
"Intended Audience :: Developers",
|
|
11
|
+
"Programming Language :: Python",
|
|
12
|
+
"Programming Language :: Python :: 3",
|
|
13
|
+
"Programming Language :: Python :: 3.8",
|
|
14
|
+
"Programming Language :: Python :: 3.9",
|
|
15
|
+
"Programming Language :: Python :: 3.10",
|
|
16
|
+
"Programming Language :: Python :: 3.11",
|
|
17
|
+
"Programming Language :: Python :: 3.12",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
"Operating System :: POSIX",
|
|
20
|
+
"Operating System :: MacOS",
|
|
21
|
+
"Operating System :: POSIX :: Linux",
|
|
22
|
+
"Operating System :: Microsoft :: Windows",
|
|
23
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
24
|
+
"Typing :: Typed"
|
|
25
|
+
]
|
|
26
|
+
packages = [
|
|
27
|
+
{ include = "basis_theory", from = "src"}
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Repository = 'https://github.com/Basis-Theory/python-sdk'
|
|
32
|
+
|
|
33
|
+
[tool.poetry.dependencies]
|
|
34
|
+
python = "^3.8"
|
|
35
|
+
httpx = ">=0.21.2"
|
|
36
|
+
pydantic = ">= 1.9.2"
|
|
37
|
+
pydantic-core = "^2.18.2"
|
|
38
|
+
typing_extensions = ">= 4.0.0"
|
|
39
|
+
|
|
40
|
+
[tool.poetry.dev-dependencies]
|
|
41
|
+
mypy = "1.0.1"
|
|
42
|
+
pytest = "^7.4.0"
|
|
43
|
+
pytest-asyncio = "^0.23.5"
|
|
44
|
+
python-dateutil = "^2.9.0"
|
|
45
|
+
types-python-dateutil = "^2.9.0.20240316"
|
|
46
|
+
ruff = "^0.5.6"
|
|
47
|
+
|
|
48
|
+
[tool.pytest.ini_options]
|
|
49
|
+
testpaths = [ "tests" ]
|
|
50
|
+
asyncio_mode = "auto"
|
|
51
|
+
|
|
52
|
+
[tool.mypy]
|
|
53
|
+
plugins = ["pydantic.mypy"]
|
|
54
|
+
|
|
55
|
+
[tool.ruff]
|
|
56
|
+
line-length = 120
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
[build-system]
|
|
60
|
+
requires = ["poetry-core"]
|
|
61
|
+
build-backend = "poetry.core.masonry.api"
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from .types import (
|
|
4
|
+
AccessRule,
|
|
5
|
+
Application,
|
|
6
|
+
ApplicationKey,
|
|
7
|
+
ApplicationPaginatedList,
|
|
8
|
+
ApplicationTemplate,
|
|
9
|
+
BinDetails,
|
|
10
|
+
BinDetailsBank,
|
|
11
|
+
BinDetailsCountry,
|
|
12
|
+
BinDetailsProduct,
|
|
13
|
+
CardDetails,
|
|
14
|
+
Condition,
|
|
15
|
+
CreateSessionResponse,
|
|
16
|
+
CreateTenantConnectionResponse,
|
|
17
|
+
CursorPagination,
|
|
18
|
+
EventTypes,
|
|
19
|
+
GetApplications,
|
|
20
|
+
GetLogs,
|
|
21
|
+
GetPermissions,
|
|
22
|
+
GetProxies,
|
|
23
|
+
GetReactorFormulas,
|
|
24
|
+
GetReactors,
|
|
25
|
+
GetTenantInvitations,
|
|
26
|
+
GetTenantMembers,
|
|
27
|
+
GetTokens,
|
|
28
|
+
GetTokensV2,
|
|
29
|
+
Log,
|
|
30
|
+
LogEntityType,
|
|
31
|
+
LogPaginatedList,
|
|
32
|
+
Pagination,
|
|
33
|
+
Permission,
|
|
34
|
+
Privacy,
|
|
35
|
+
ProblemDetails,
|
|
36
|
+
Proxy,
|
|
37
|
+
ProxyPaginatedList,
|
|
38
|
+
ProxyTransform,
|
|
39
|
+
PublicKey,
|
|
40
|
+
ReactResponse,
|
|
41
|
+
Reactor,
|
|
42
|
+
ReactorFormula,
|
|
43
|
+
ReactorFormulaConfiguration,
|
|
44
|
+
ReactorFormulaPaginatedList,
|
|
45
|
+
ReactorFormulaRequestParameter,
|
|
46
|
+
ReactorPaginatedList,
|
|
47
|
+
Role,
|
|
48
|
+
StringStringKeyValuePair,
|
|
49
|
+
Tenant,
|
|
50
|
+
TenantConnectionOptions,
|
|
51
|
+
TenantInvitationResponse,
|
|
52
|
+
TenantInvitationResponsePaginatedList,
|
|
53
|
+
TenantInvitationStatus,
|
|
54
|
+
TenantMemberResponse,
|
|
55
|
+
TenantMemberResponsePaginatedList,
|
|
56
|
+
TenantUsageReport,
|
|
57
|
+
ThreeDsAcsRenderingType,
|
|
58
|
+
ThreeDsAddress,
|
|
59
|
+
ThreeDsAuthentication,
|
|
60
|
+
ThreeDsCardholderAccountInfo,
|
|
61
|
+
ThreeDsCardholderAuthenticationInfo,
|
|
62
|
+
ThreeDsCardholderInfo,
|
|
63
|
+
ThreeDsCardholderPhoneNumber,
|
|
64
|
+
ThreeDsDeviceInfo,
|
|
65
|
+
ThreeDsMerchantInfo,
|
|
66
|
+
ThreeDsMerchantRiskInfo,
|
|
67
|
+
ThreeDsMessageExtension,
|
|
68
|
+
ThreeDsMethod,
|
|
69
|
+
ThreeDsMobileSdkRenderOptions,
|
|
70
|
+
ThreeDsPriorAuthenticationInfo,
|
|
71
|
+
ThreeDsPurchaseInfo,
|
|
72
|
+
ThreeDsRequestorInfo,
|
|
73
|
+
ThreeDsSession,
|
|
74
|
+
ThreeDsVersion,
|
|
75
|
+
Token,
|
|
76
|
+
TokenCursorPaginatedList,
|
|
77
|
+
TokenEnrichments,
|
|
78
|
+
TokenMetrics,
|
|
79
|
+
TokenPaginatedList,
|
|
80
|
+
TokenReport,
|
|
81
|
+
UpdatePrivacy,
|
|
82
|
+
User,
|
|
83
|
+
ValidationProblemDetails,
|
|
84
|
+
Webhook,
|
|
85
|
+
WebhookList,
|
|
86
|
+
WebhookListPagination,
|
|
87
|
+
WebhookStatus,
|
|
88
|
+
)
|
|
89
|
+
from .errors import (
|
|
90
|
+
BadRequestError,
|
|
91
|
+
ConflictError,
|
|
92
|
+
ForbiddenError,
|
|
93
|
+
NotFoundError,
|
|
94
|
+
UnauthorizedError,
|
|
95
|
+
UnprocessableEntityError,
|
|
96
|
+
)
|
|
97
|
+
from . import (
|
|
98
|
+
application_keys,
|
|
99
|
+
application_templates,
|
|
100
|
+
applications,
|
|
101
|
+
logs,
|
|
102
|
+
permissions,
|
|
103
|
+
proxies,
|
|
104
|
+
reactorformulas,
|
|
105
|
+
reactors,
|
|
106
|
+
roles,
|
|
107
|
+
sessions,
|
|
108
|
+
tenants,
|
|
109
|
+
threeds,
|
|
110
|
+
tokens,
|
|
111
|
+
webhooks,
|
|
112
|
+
)
|
|
113
|
+
from .client import AsyncBasisTheory, BasisTheory
|
|
114
|
+
from .environment import BasisTheoryEnvironment
|
|
115
|
+
from .version import __version__
|
|
116
|
+
|
|
117
|
+
__all__ = [
|
|
118
|
+
"AccessRule",
|
|
119
|
+
"Application",
|
|
120
|
+
"ApplicationKey",
|
|
121
|
+
"ApplicationPaginatedList",
|
|
122
|
+
"ApplicationTemplate",
|
|
123
|
+
"AsyncBasisTheory",
|
|
124
|
+
"BadRequestError",
|
|
125
|
+
"BasisTheory",
|
|
126
|
+
"BasisTheoryEnvironment",
|
|
127
|
+
"BinDetails",
|
|
128
|
+
"BinDetailsBank",
|
|
129
|
+
"BinDetailsCountry",
|
|
130
|
+
"BinDetailsProduct",
|
|
131
|
+
"CardDetails",
|
|
132
|
+
"Condition",
|
|
133
|
+
"ConflictError",
|
|
134
|
+
"CreateSessionResponse",
|
|
135
|
+
"CreateTenantConnectionResponse",
|
|
136
|
+
"CursorPagination",
|
|
137
|
+
"EventTypes",
|
|
138
|
+
"ForbiddenError",
|
|
139
|
+
"GetApplications",
|
|
140
|
+
"GetLogs",
|
|
141
|
+
"GetPermissions",
|
|
142
|
+
"GetProxies",
|
|
143
|
+
"GetReactorFormulas",
|
|
144
|
+
"GetReactors",
|
|
145
|
+
"GetTenantInvitations",
|
|
146
|
+
"GetTenantMembers",
|
|
147
|
+
"GetTokens",
|
|
148
|
+
"GetTokensV2",
|
|
149
|
+
"Log",
|
|
150
|
+
"LogEntityType",
|
|
151
|
+
"LogPaginatedList",
|
|
152
|
+
"NotFoundError",
|
|
153
|
+
"Pagination",
|
|
154
|
+
"Permission",
|
|
155
|
+
"Privacy",
|
|
156
|
+
"ProblemDetails",
|
|
157
|
+
"Proxy",
|
|
158
|
+
"ProxyPaginatedList",
|
|
159
|
+
"ProxyTransform",
|
|
160
|
+
"PublicKey",
|
|
161
|
+
"ReactResponse",
|
|
162
|
+
"Reactor",
|
|
163
|
+
"ReactorFormula",
|
|
164
|
+
"ReactorFormulaConfiguration",
|
|
165
|
+
"ReactorFormulaPaginatedList",
|
|
166
|
+
"ReactorFormulaRequestParameter",
|
|
167
|
+
"ReactorPaginatedList",
|
|
168
|
+
"Role",
|
|
169
|
+
"StringStringKeyValuePair",
|
|
170
|
+
"Tenant",
|
|
171
|
+
"TenantConnectionOptions",
|
|
172
|
+
"TenantInvitationResponse",
|
|
173
|
+
"TenantInvitationResponsePaginatedList",
|
|
174
|
+
"TenantInvitationStatus",
|
|
175
|
+
"TenantMemberResponse",
|
|
176
|
+
"TenantMemberResponsePaginatedList",
|
|
177
|
+
"TenantUsageReport",
|
|
178
|
+
"ThreeDsAcsRenderingType",
|
|
179
|
+
"ThreeDsAddress",
|
|
180
|
+
"ThreeDsAuthentication",
|
|
181
|
+
"ThreeDsCardholderAccountInfo",
|
|
182
|
+
"ThreeDsCardholderAuthenticationInfo",
|
|
183
|
+
"ThreeDsCardholderInfo",
|
|
184
|
+
"ThreeDsCardholderPhoneNumber",
|
|
185
|
+
"ThreeDsDeviceInfo",
|
|
186
|
+
"ThreeDsMerchantInfo",
|
|
187
|
+
"ThreeDsMerchantRiskInfo",
|
|
188
|
+
"ThreeDsMessageExtension",
|
|
189
|
+
"ThreeDsMethod",
|
|
190
|
+
"ThreeDsMobileSdkRenderOptions",
|
|
191
|
+
"ThreeDsPriorAuthenticationInfo",
|
|
192
|
+
"ThreeDsPurchaseInfo",
|
|
193
|
+
"ThreeDsRequestorInfo",
|
|
194
|
+
"ThreeDsSession",
|
|
195
|
+
"ThreeDsVersion",
|
|
196
|
+
"Token",
|
|
197
|
+
"TokenCursorPaginatedList",
|
|
198
|
+
"TokenEnrichments",
|
|
199
|
+
"TokenMetrics",
|
|
200
|
+
"TokenPaginatedList",
|
|
201
|
+
"TokenReport",
|
|
202
|
+
"UnauthorizedError",
|
|
203
|
+
"UnprocessableEntityError",
|
|
204
|
+
"UpdatePrivacy",
|
|
205
|
+
"User",
|
|
206
|
+
"ValidationProblemDetails",
|
|
207
|
+
"Webhook",
|
|
208
|
+
"WebhookList",
|
|
209
|
+
"WebhookListPagination",
|
|
210
|
+
"WebhookStatus",
|
|
211
|
+
"__version__",
|
|
212
|
+
"application_keys",
|
|
213
|
+
"application_templates",
|
|
214
|
+
"applications",
|
|
215
|
+
"logs",
|
|
216
|
+
"permissions",
|
|
217
|
+
"proxies",
|
|
218
|
+
"reactorformulas",
|
|
219
|
+
"reactors",
|
|
220
|
+
"roles",
|
|
221
|
+
"sessions",
|
|
222
|
+
"tenants",
|
|
223
|
+
"threeds",
|
|
224
|
+
"tokens",
|
|
225
|
+
"webhooks",
|
|
226
|
+
]
|