dodopayments 1.34.0__py3-none-any.whl → 1.34.1__py3-none-any.whl
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.
Potentially problematic release.
This version of dodopayments might be problematic. Click here for more details.
- dodopayments/__init__.py +2 -1
- dodopayments/_base_client.py +22 -0
- dodopayments/_version.py +1 -1
- {dodopayments-1.34.0.dist-info → dodopayments-1.34.1.dist-info}/METADATA +54 -2
- {dodopayments-1.34.0.dist-info → dodopayments-1.34.1.dist-info}/RECORD +7 -7
- {dodopayments-1.34.0.dist-info → dodopayments-1.34.1.dist-info}/WHEEL +0 -0
- {dodopayments-1.34.0.dist-info → dodopayments-1.34.1.dist-info}/licenses/LICENSE +0 -0
dodopayments/__init__.py
CHANGED
|
@@ -37,7 +37,7 @@ from ._exceptions import (
|
|
|
37
37
|
UnprocessableEntityError,
|
|
38
38
|
APIResponseValidationError,
|
|
39
39
|
)
|
|
40
|
-
from ._base_client import DefaultHttpxClient, DefaultAsyncHttpxClient
|
|
40
|
+
from ._base_client import DefaultHttpxClient, DefaultAioHttpClient, DefaultAsyncHttpxClient
|
|
41
41
|
from ._utils._logs import setup_logging as _setup_logging
|
|
42
42
|
|
|
43
43
|
__all__ = [
|
|
@@ -80,6 +80,7 @@ __all__ = [
|
|
|
80
80
|
"DEFAULT_CONNECTION_LIMITS",
|
|
81
81
|
"DefaultHttpxClient",
|
|
82
82
|
"DefaultAsyncHttpxClient",
|
|
83
|
+
"DefaultAioHttpClient",
|
|
83
84
|
]
|
|
84
85
|
|
|
85
86
|
if not _t.TYPE_CHECKING:
|
dodopayments/_base_client.py
CHANGED
|
@@ -1289,6 +1289,24 @@ class _DefaultAsyncHttpxClient(httpx.AsyncClient):
|
|
|
1289
1289
|
super().__init__(**kwargs)
|
|
1290
1290
|
|
|
1291
1291
|
|
|
1292
|
+
try:
|
|
1293
|
+
import httpx_aiohttp
|
|
1294
|
+
except ImportError:
|
|
1295
|
+
|
|
1296
|
+
class _DefaultAioHttpClient(httpx.AsyncClient):
|
|
1297
|
+
def __init__(self, **_kwargs: Any) -> None:
|
|
1298
|
+
raise RuntimeError("To use the aiohttp client you must have installed the package with the `aiohttp` extra")
|
|
1299
|
+
else:
|
|
1300
|
+
|
|
1301
|
+
class _DefaultAioHttpClient(httpx_aiohttp.HttpxAiohttpClient): # type: ignore
|
|
1302
|
+
def __init__(self, **kwargs: Any) -> None:
|
|
1303
|
+
kwargs.setdefault("timeout", DEFAULT_TIMEOUT)
|
|
1304
|
+
kwargs.setdefault("limits", DEFAULT_CONNECTION_LIMITS)
|
|
1305
|
+
kwargs.setdefault("follow_redirects", True)
|
|
1306
|
+
|
|
1307
|
+
super().__init__(**kwargs)
|
|
1308
|
+
|
|
1309
|
+
|
|
1292
1310
|
if TYPE_CHECKING:
|
|
1293
1311
|
DefaultAsyncHttpxClient = httpx.AsyncClient
|
|
1294
1312
|
"""An alias to `httpx.AsyncClient` that provides the same defaults that this SDK
|
|
@@ -1297,8 +1315,12 @@ if TYPE_CHECKING:
|
|
|
1297
1315
|
This is useful because overriding the `http_client` with your own instance of
|
|
1298
1316
|
`httpx.AsyncClient` will result in httpx's defaults being used, not ours.
|
|
1299
1317
|
"""
|
|
1318
|
+
|
|
1319
|
+
DefaultAioHttpClient = httpx.AsyncClient
|
|
1320
|
+
"""An alias to `httpx.AsyncClient` that changes the default HTTP transport to `aiohttp`."""
|
|
1300
1321
|
else:
|
|
1301
1322
|
DefaultAsyncHttpxClient = _DefaultAsyncHttpxClient
|
|
1323
|
+
DefaultAioHttpClient = _DefaultAioHttpClient
|
|
1302
1324
|
|
|
1303
1325
|
|
|
1304
1326
|
class AsyncHttpxClientWrapper(DefaultAsyncHttpxClient):
|
dodopayments/_version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: dodopayments
|
|
3
|
-
Version: 1.34.
|
|
3
|
+
Version: 1.34.1
|
|
4
4
|
Summary: The official Python library for the Dodo Payments API
|
|
5
5
|
Project-URL: Homepage, https://github.com/dodopayments/dodopayments-python
|
|
6
6
|
Project-URL: Repository, https://github.com/dodopayments/dodopayments-python
|
|
@@ -27,6 +27,9 @@ Requires-Dist: httpx<1,>=0.23.0
|
|
|
27
27
|
Requires-Dist: pydantic<3,>=1.9.0
|
|
28
28
|
Requires-Dist: sniffio
|
|
29
29
|
Requires-Dist: typing-extensions<5,>=4.10
|
|
30
|
+
Provides-Extra: aiohttp
|
|
31
|
+
Requires-Dist: aiohttp; extra == 'aiohttp'
|
|
32
|
+
Requires-Dist: httpx-aiohttp>=0.1.6; extra == 'aiohttp'
|
|
30
33
|
Description-Content-Type: text/markdown
|
|
31
34
|
|
|
32
35
|
# Dodo Payments Python API library
|
|
@@ -129,6 +132,55 @@ asyncio.run(main())
|
|
|
129
132
|
|
|
130
133
|
Functionality between the synchronous and asynchronous clients is otherwise identical.
|
|
131
134
|
|
|
135
|
+
### With aiohttp
|
|
136
|
+
|
|
137
|
+
By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.
|
|
138
|
+
|
|
139
|
+
You can enable this by installing `aiohttp`:
|
|
140
|
+
|
|
141
|
+
```sh
|
|
142
|
+
# install from PyPI
|
|
143
|
+
pip install dodopayments[aiohttp]
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
import os
|
|
150
|
+
import asyncio
|
|
151
|
+
from dodopayments import DefaultAioHttpClient
|
|
152
|
+
from dodopayments import AsyncDodoPayments
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
async def main() -> None:
|
|
156
|
+
async with AsyncDodoPayments(
|
|
157
|
+
bearer_token=os.environ.get(
|
|
158
|
+
"DODO_PAYMENTS_API_KEY"
|
|
159
|
+
), # This is the default and can be omitted
|
|
160
|
+
http_client=DefaultAioHttpClient(),
|
|
161
|
+
) as client:
|
|
162
|
+
payment = await client.payments.create(
|
|
163
|
+
billing={
|
|
164
|
+
"city": "city",
|
|
165
|
+
"country": "AF",
|
|
166
|
+
"state": "state",
|
|
167
|
+
"street": "street",
|
|
168
|
+
"zipcode": "zipcode",
|
|
169
|
+
},
|
|
170
|
+
customer={"customer_id": "customer_id"},
|
|
171
|
+
product_cart=[
|
|
172
|
+
{
|
|
173
|
+
"product_id": "product_id",
|
|
174
|
+
"quantity": 0,
|
|
175
|
+
}
|
|
176
|
+
],
|
|
177
|
+
)
|
|
178
|
+
print(payment.payment_id)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
asyncio.run(main())
|
|
182
|
+
```
|
|
183
|
+
|
|
132
184
|
## Using types
|
|
133
185
|
|
|
134
186
|
Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:
|
|
@@ -322,7 +374,7 @@ client.with_options(max_retries=5).payments.create(
|
|
|
322
374
|
### Timeouts
|
|
323
375
|
|
|
324
376
|
By default requests time out after 1 minute. You can configure this with a `timeout` option,
|
|
325
|
-
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
|
|
377
|
+
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
|
|
326
378
|
|
|
327
379
|
```python
|
|
328
380
|
from dodopayments import DodoPayments
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
dodopayments/__init__.py,sha256=
|
|
2
|
-
dodopayments/_base_client.py,sha256=
|
|
1
|
+
dodopayments/__init__.py,sha256=jLgJiqM7q7-wstUdqp2RuuWVjLPGor5q-vw3liQR5lw,2711
|
|
2
|
+
dodopayments/_base_client.py,sha256=uukLcGUZH6eVyITp9lKMxmEt4xPRWW4ydqSZqxXEetc,66721
|
|
3
3
|
dodopayments/_client.py,sha256=6gxmSa9iNmeNzmpy05mph0aAbrzFU8P0swS3oYc0dKY,27376
|
|
4
4
|
dodopayments/_compat.py,sha256=VWemUKbj6DDkQ-O4baSpHVLJafotzeXmCQGJugfVTIw,6580
|
|
5
5
|
dodopayments/_constants.py,sha256=S14PFzyN9-I31wiV7SmIlL5Ga0MLHxdvegInGdXH7tM,462
|
|
@@ -11,7 +11,7 @@ dodopayments/_resource.py,sha256=Jfh17Q3kKzAhO-dlfIwYlueN9t1edaaY_vmnC9vErpA,113
|
|
|
11
11
|
dodopayments/_response.py,sha256=PDvrSN3E3IkXVw2GvyOCTNB8ch0Xn9yaWQz4w1nHZEQ,28854
|
|
12
12
|
dodopayments/_streaming.py,sha256=U4D6MhotaUaGaHz32lBt0XM98IOPIpPbKHUfbb0HGCk,10124
|
|
13
13
|
dodopayments/_types.py,sha256=gP0yR7AIegimhmZ6rYIjSHFCr9YWzvh-jZabbVcgtio,6203
|
|
14
|
-
dodopayments/_version.py,sha256=
|
|
14
|
+
dodopayments/_version.py,sha256=89jhNpsrrRxFm_Ay1fFqnmCFYNHvwHnIB8gv31usGNE,165
|
|
15
15
|
dodopayments/pagination.py,sha256=WYDrAWHvGL58Fe6X2yYZyYTAFvzWOR63JAsKURk2ti4,1308
|
|
16
16
|
dodopayments/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
17
|
dodopayments/_utils/__init__.py,sha256=PNZ_QJuzZEgyYXqkO1HVhGkj5IU9bglVUcw7H-Knjzw,2062
|
|
@@ -144,7 +144,7 @@ dodopayments/types/invoices/__init__.py,sha256=OKfJYcKb4NObdiRObqJV_dOyDQ8feXekD
|
|
|
144
144
|
dodopayments/types/products/__init__.py,sha256=-W2ETtkni8cZpsC4Eg1aRwuLg1plV1U429JFOR1U4Rw,273
|
|
145
145
|
dodopayments/types/products/image_update_params.py,sha256=JmSZGjXI9uZgKdO9_7CINyIOmuphlmZr7-7P7kE-R5Q,308
|
|
146
146
|
dodopayments/types/products/image_update_response.py,sha256=TcJyXjoJlONpwwR6yZdIuBTu2VNyLRZFELfstD9_V-o,273
|
|
147
|
-
dodopayments-1.34.
|
|
148
|
-
dodopayments-1.34.
|
|
149
|
-
dodopayments-1.34.
|
|
150
|
-
dodopayments-1.34.
|
|
147
|
+
dodopayments-1.34.1.dist-info/METADATA,sha256=B4Xg_gkYASUGbPBtaQpBrFHC95eTpmNpsS6mvNUs3XU,18916
|
|
148
|
+
dodopayments-1.34.1.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
149
|
+
dodopayments-1.34.1.dist-info/licenses/LICENSE,sha256=3_sqrBb5J3AT3FsjMKEOBRZhweWVsl_s_RjFlclm1vQ,11343
|
|
150
|
+
dodopayments-1.34.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|