deeporigin-data-sdk 0.1.0a67__py3-none-any.whl → 0.1.0a69__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.
@@ -36,7 +36,7 @@ from ._exceptions import (
36
36
  UnprocessableEntityError,
37
37
  APIResponseValidationError,
38
38
  )
39
- from ._base_client import DefaultHttpxClient, DefaultAsyncHttpxClient
39
+ from ._base_client import DefaultHttpxClient, DefaultAioHttpClient, DefaultAsyncHttpxClient
40
40
  from ._utils._logs import setup_logging as _setup_logging
41
41
 
42
42
  __all__ = [
@@ -78,6 +78,7 @@ __all__ = [
78
78
  "DEFAULT_CONNECTION_LIMITS",
79
79
  "DefaultHttpxClient",
80
80
  "DefaultAsyncHttpxClient",
81
+ "DefaultAioHttpClient",
81
82
  ]
82
83
 
83
84
  if not _t.TYPE_CHECKING:
@@ -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):
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "deeporigin_data"
4
- __version__ = "0.1.0-alpha.67" # x-release-please-version
4
+ __version__ = "0.1.0-alpha.69" # x-release-please-version
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: deeporigin_data_sdk
3
- Version: 0.1.0a67
3
+ Version: 0.1.0a69
4
4
  Summary: The official Python library for the deeporigin_data API
5
5
  Project-URL: Homepage, https://github.com/deeporiginbio/deeporigin-data-sdk
6
6
  Project-URL: Repository, https://github.com/deeporiginbio/deeporigin-data-sdk
@@ -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
  # Deeporigin Data Python API library
@@ -101,6 +104,41 @@ asyncio.run(main())
101
104
 
102
105
  Functionality between the synchronous and asynchronous clients is otherwise identical.
103
106
 
107
+ ### With aiohttp
108
+
109
+ By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.
110
+
111
+ You can enable this by installing `aiohttp`:
112
+
113
+ ```sh
114
+ # install from PyPI
115
+ pip install --pre deeporigin_data_sdk[aiohttp]
116
+ ```
117
+
118
+ Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
119
+
120
+ ```python
121
+ import os
122
+ import asyncio
123
+ from deeporigin_data import DefaultAioHttpClient
124
+ from deeporigin_data import AsyncDeeporiginData
125
+
126
+
127
+ async def main() -> None:
128
+ async with AsyncDeeporiginData(
129
+ org_id="My Org ID",
130
+ token=os.environ.get("ORG_BEARER_TOKEN"), # This is the default and can be omitted
131
+ http_client=DefaultAioHttpClient(),
132
+ ) as client:
133
+ describe_row_response = await client.describe_row(
134
+ row_id="rowId",
135
+ )
136
+ print(describe_row_response.data)
137
+
138
+
139
+ asyncio.run(main())
140
+ ```
141
+
104
142
  ## Using types
105
143
 
106
144
  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:
@@ -200,7 +238,7 @@ client.with_options(max_retries=5).describe_row(
200
238
  ### Timeouts
201
239
 
202
240
  By default requests time out after 1 minute. You can configure this with a `timeout` option,
203
- which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
241
+ which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
204
242
 
205
243
  ```python
206
244
  from deeporigin_data import DeeporiginData
@@ -1,5 +1,5 @@
1
- deeporigin_data/__init__.py,sha256=_1jHk-ZDjq8xlaketuGzIObYaQy2_sQC44AmxyzI_sM,2644
2
- deeporigin_data/_base_client.py,sha256=tQ1V6dw8jphj0fgcVbPKQWApTT697LuoBrGkAg3k9ME,65893
1
+ deeporigin_data/__init__.py,sha256=GcSYGhjO8h3JlVcNC7CouZJUsoefUYjFRQFRpylXg5c,2694
2
+ deeporigin_data/_base_client.py,sha256=xAVMwRYOW6B9fGncMM-yE2yDlBMVsb9QSHB1Q5ayDRk,66724
3
3
  deeporigin_data/_client.py,sha256=ulANUIkBX3gHIvrpeU1IRCakrx5gIcgD56I0FmwiaXo,171969
4
4
  deeporigin_data/_compat.py,sha256=VWemUKbj6DDkQ-O4baSpHVLJafotzeXmCQGJugfVTIw,6580
5
5
  deeporigin_data/_constants.py,sha256=S14PFzyN9-I31wiV7SmIlL5Ga0MLHxdvegInGdXH7tM,462
@@ -11,7 +11,7 @@ deeporigin_data/_resource.py,sha256=tkm4gF9YRotE93j48jTDBSGs8wyVa0E5NS9fj19e38c,
11
11
  deeporigin_data/_response.py,sha256=i98w-_OFUAnDfRaLynqu2Qrgh39xKGq9WQ1DK2CueMs,28870
12
12
  deeporigin_data/_streaming.py,sha256=yG857cOSJD3gbc7mEc2wqfvcPVLMGmYX4hBOqqIT5RE,10132
13
13
  deeporigin_data/_types.py,sha256=z_gHfGnZNr7ReZxda_iICWQnmy5anm8-i8lRB3jpRL0,6206
14
- deeporigin_data/_version.py,sha256=lGAaRHDNWk_1Ic-GO2L9MeeVs36xSc2ayW4__tmIr1M,176
14
+ deeporigin_data/_version.py,sha256=tQUm67qkVi72aVCsa7-GVGXt2uVDWaU4-ewfpr14uLE,176
15
15
  deeporigin_data/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  deeporigin_data/_utils/__init__.py,sha256=PNZ_QJuzZEgyYXqkO1HVhGkj5IU9bglVUcw7H-Knjzw,2062
17
17
  deeporigin_data/_utils/_logs.py,sha256=R7dnUaDs2cdYbq1Ee16dHy863wdcTZRRzubw9KE0qNc,801
@@ -121,7 +121,7 @@ deeporigin_data/types/shared_params/add_column_base.py,sha256=s8cbOjluJmf4Pzmg_v
121
121
  deeporigin_data/types/shared_params/add_column_union.py,sha256=uEJwB-xtbKY19Hq7a2vIrGdDfPcHIBwp9_R63Qf9KO0,1036
122
122
  deeporigin_data/types/shared_params/condition.py,sha256=38ItZ9QZrA3rnXNgds7KZcXCZ-h1zVttiD1R6uf5IGQ,3153
123
123
  deeporigin_data/types/shared_params/row_filter_join.py,sha256=QIo2yhjJJZLcGF-hBF7YcLcYHLhf5uq5EkQG-0WJjtU,595
124
- deeporigin_data_sdk-0.1.0a67.dist-info/METADATA,sha256=ptdQnd37bHypGX0d6m8hJ46JWMA0U1eZtjU5y_-DFiU,13795
125
- deeporigin_data_sdk-0.1.0a67.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
126
- deeporigin_data_sdk-0.1.0a67.dist-info/licenses/LICENSE,sha256=jT1To9IZ3XdRqtpv8wDrIwpatTUvf5yP0sFYhEtJVZY,11345
127
- deeporigin_data_sdk-0.1.0a67.dist-info/RECORD,,
124
+ deeporigin_data_sdk-0.1.0a69.dist-info/METADATA,sha256=U6nzt_eHzmyrKubMQpYnSEhYjNpPIeYg0JGeNwnGhJM,14863
125
+ deeporigin_data_sdk-0.1.0a69.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
126
+ deeporigin_data_sdk-0.1.0a69.dist-info/licenses/LICENSE,sha256=jT1To9IZ3XdRqtpv8wDrIwpatTUvf5yP0sFYhEtJVZY,11345
127
+ deeporigin_data_sdk-0.1.0a69.dist-info/RECORD,,