channel3-sdk 2.1.0__py3-none-any.whl → 2.2.0__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 channel3-sdk might be problematic. Click here for more details.
- channel3_sdk/__init__.py +0 -2
- channel3_sdk/_client.py +12 -70
- channel3_sdk/_version.py +1 -1
- {channel3_sdk-2.1.0.dist-info → channel3_sdk-2.2.0.dist-info}/METADATA +1 -5
- {channel3_sdk-2.1.0.dist-info → channel3_sdk-2.2.0.dist-info}/RECORD +7 -7
- {channel3_sdk-2.1.0.dist-info → channel3_sdk-2.2.0.dist-info}/WHEEL +0 -0
- {channel3_sdk-2.1.0.dist-info → channel3_sdk-2.2.0.dist-info}/licenses/LICENSE +0 -0
channel3_sdk/__init__.py
CHANGED
|
@@ -6,7 +6,6 @@ from . import types
|
|
|
6
6
|
from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes
|
|
7
7
|
from ._utils import file_from_path
|
|
8
8
|
from ._client import (
|
|
9
|
-
ENVIRONMENTS,
|
|
10
9
|
Client,
|
|
11
10
|
Stream,
|
|
12
11
|
Timeout,
|
|
@@ -72,7 +71,6 @@ __all__ = [
|
|
|
72
71
|
"AsyncStream",
|
|
73
72
|
"Channel3",
|
|
74
73
|
"AsyncChannel3",
|
|
75
|
-
"ENVIRONMENTS",
|
|
76
74
|
"file_from_path",
|
|
77
75
|
"BaseModel",
|
|
78
76
|
"DEFAULT_TIMEOUT",
|
channel3_sdk/_client.py
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import os
|
|
6
|
-
from typing import Any,
|
|
7
|
-
from typing_extensions import Self,
|
|
6
|
+
from typing import Any, Union, Mapping
|
|
7
|
+
from typing_extensions import Self, override
|
|
8
8
|
|
|
9
9
|
import httpx
|
|
10
10
|
|
|
@@ -41,7 +41,6 @@ from ._base_client import (
|
|
|
41
41
|
)
|
|
42
42
|
|
|
43
43
|
__all__ = [
|
|
44
|
-
"ENVIRONMENTS",
|
|
45
44
|
"Timeout",
|
|
46
45
|
"Transport",
|
|
47
46
|
"ProxiesTypes",
|
|
@@ -52,11 +51,6 @@ __all__ = [
|
|
|
52
51
|
"AsyncClient",
|
|
53
52
|
]
|
|
54
53
|
|
|
55
|
-
ENVIRONMENTS: Dict[str, str] = {
|
|
56
|
-
"production": "https://api.trychannel3.com",
|
|
57
|
-
"development": "https://localhost:8000",
|
|
58
|
-
}
|
|
59
|
-
|
|
60
54
|
|
|
61
55
|
class Channel3(SyncAPIClient):
|
|
62
56
|
search: search.SearchResource
|
|
@@ -69,14 +63,11 @@ class Channel3(SyncAPIClient):
|
|
|
69
63
|
# client options
|
|
70
64
|
api_key: str
|
|
71
65
|
|
|
72
|
-
_environment: Literal["production", "development"] | NotGiven
|
|
73
|
-
|
|
74
66
|
def __init__(
|
|
75
67
|
self,
|
|
76
68
|
*,
|
|
77
69
|
api_key: str | None = None,
|
|
78
|
-
|
|
79
|
-
base_url: str | httpx.URL | None | NotGiven = NOT_GIVEN,
|
|
70
|
+
base_url: str | httpx.URL | None = None,
|
|
80
71
|
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
|
|
81
72
|
max_retries: int = DEFAULT_MAX_RETRIES,
|
|
82
73
|
default_headers: Mapping[str, str] | None = None,
|
|
@@ -107,31 +98,10 @@ class Channel3(SyncAPIClient):
|
|
|
107
98
|
)
|
|
108
99
|
self.api_key = api_key
|
|
109
100
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
# cast required because mypy doesn't understand the type narrowing
|
|
115
|
-
base_url = cast("str | httpx.URL", base_url) # pyright: ignore[reportUnnecessaryCast]
|
|
116
|
-
elif is_given(environment):
|
|
117
|
-
if base_url_env and base_url is not None:
|
|
118
|
-
raise ValueError(
|
|
119
|
-
"Ambiguous URL; The `CHANNEL3_BASE_URL` env var and the `environment` argument are given. If you want to use the environment, you must pass base_url=None",
|
|
120
|
-
)
|
|
121
|
-
|
|
122
|
-
try:
|
|
123
|
-
base_url = ENVIRONMENTS[environment]
|
|
124
|
-
except KeyError as exc:
|
|
125
|
-
raise ValueError(f"Unknown environment: {environment}") from exc
|
|
126
|
-
elif base_url_env is not None:
|
|
127
|
-
base_url = base_url_env
|
|
128
|
-
else:
|
|
129
|
-
self._environment = environment = "production"
|
|
130
|
-
|
|
131
|
-
try:
|
|
132
|
-
base_url = ENVIRONMENTS[environment]
|
|
133
|
-
except KeyError as exc:
|
|
134
|
-
raise ValueError(f"Unknown environment: {environment}") from exc
|
|
101
|
+
if base_url is None:
|
|
102
|
+
base_url = os.environ.get("CHANNEL3_BASE_URL")
|
|
103
|
+
if base_url is None:
|
|
104
|
+
base_url = f"https://api.trychannel3.com"
|
|
135
105
|
|
|
136
106
|
super().__init__(
|
|
137
107
|
version=__version__,
|
|
@@ -175,7 +145,6 @@ class Channel3(SyncAPIClient):
|
|
|
175
145
|
self,
|
|
176
146
|
*,
|
|
177
147
|
api_key: str | None = None,
|
|
178
|
-
environment: Literal["production", "development"] | None = None,
|
|
179
148
|
base_url: str | httpx.URL | None = None,
|
|
180
149
|
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
|
|
181
150
|
http_client: httpx.Client | None = None,
|
|
@@ -211,7 +180,6 @@ class Channel3(SyncAPIClient):
|
|
|
211
180
|
return self.__class__(
|
|
212
181
|
api_key=api_key or self.api_key,
|
|
213
182
|
base_url=base_url or self.base_url,
|
|
214
|
-
environment=environment or self._environment,
|
|
215
183
|
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
|
|
216
184
|
http_client=http_client,
|
|
217
185
|
max_retries=max_retries if is_given(max_retries) else self.max_retries,
|
|
@@ -288,14 +256,11 @@ class AsyncChannel3(AsyncAPIClient):
|
|
|
288
256
|
# client options
|
|
289
257
|
api_key: str
|
|
290
258
|
|
|
291
|
-
_environment: Literal["production", "development"] | NotGiven
|
|
292
|
-
|
|
293
259
|
def __init__(
|
|
294
260
|
self,
|
|
295
261
|
*,
|
|
296
262
|
api_key: str | None = None,
|
|
297
|
-
|
|
298
|
-
base_url: str | httpx.URL | None | NotGiven = NOT_GIVEN,
|
|
263
|
+
base_url: str | httpx.URL | None = None,
|
|
299
264
|
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
|
|
300
265
|
max_retries: int = DEFAULT_MAX_RETRIES,
|
|
301
266
|
default_headers: Mapping[str, str] | None = None,
|
|
@@ -326,31 +291,10 @@ class AsyncChannel3(AsyncAPIClient):
|
|
|
326
291
|
)
|
|
327
292
|
self.api_key = api_key
|
|
328
293
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
# cast required because mypy doesn't understand the type narrowing
|
|
334
|
-
base_url = cast("str | httpx.URL", base_url) # pyright: ignore[reportUnnecessaryCast]
|
|
335
|
-
elif is_given(environment):
|
|
336
|
-
if base_url_env and base_url is not None:
|
|
337
|
-
raise ValueError(
|
|
338
|
-
"Ambiguous URL; The `CHANNEL3_BASE_URL` env var and the `environment` argument are given. If you want to use the environment, you must pass base_url=None",
|
|
339
|
-
)
|
|
340
|
-
|
|
341
|
-
try:
|
|
342
|
-
base_url = ENVIRONMENTS[environment]
|
|
343
|
-
except KeyError as exc:
|
|
344
|
-
raise ValueError(f"Unknown environment: {environment}") from exc
|
|
345
|
-
elif base_url_env is not None:
|
|
346
|
-
base_url = base_url_env
|
|
347
|
-
else:
|
|
348
|
-
self._environment = environment = "production"
|
|
349
|
-
|
|
350
|
-
try:
|
|
351
|
-
base_url = ENVIRONMENTS[environment]
|
|
352
|
-
except KeyError as exc:
|
|
353
|
-
raise ValueError(f"Unknown environment: {environment}") from exc
|
|
294
|
+
if base_url is None:
|
|
295
|
+
base_url = os.environ.get("CHANNEL3_BASE_URL")
|
|
296
|
+
if base_url is None:
|
|
297
|
+
base_url = f"https://api.trychannel3.com"
|
|
354
298
|
|
|
355
299
|
super().__init__(
|
|
356
300
|
version=__version__,
|
|
@@ -394,7 +338,6 @@ class AsyncChannel3(AsyncAPIClient):
|
|
|
394
338
|
self,
|
|
395
339
|
*,
|
|
396
340
|
api_key: str | None = None,
|
|
397
|
-
environment: Literal["production", "development"] | None = None,
|
|
398
341
|
base_url: str | httpx.URL | None = None,
|
|
399
342
|
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
|
|
400
343
|
http_client: httpx.AsyncClient | None = None,
|
|
@@ -430,7 +373,6 @@ class AsyncChannel3(AsyncAPIClient):
|
|
|
430
373
|
return self.__class__(
|
|
431
374
|
api_key=api_key or self.api_key,
|
|
432
375
|
base_url=base_url or self.base_url,
|
|
433
|
-
environment=environment or self._environment,
|
|
434
376
|
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
|
|
435
377
|
http_client=http_client,
|
|
436
378
|
max_retries=max_retries if is_given(max_retries) else self.max_retries,
|
channel3_sdk/_version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: channel3_sdk
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: The official Python library for the channel3 API
|
|
5
5
|
Project-URL: Homepage, https://github.com/channel3-ai/sdk-python
|
|
6
6
|
Project-URL: Repository, https://github.com/channel3-ai/sdk-python
|
|
@@ -65,8 +65,6 @@ from channel3_sdk import Channel3
|
|
|
65
65
|
|
|
66
66
|
client = Channel3(
|
|
67
67
|
api_key=os.environ.get("CHANNEL3_API_KEY"), # This is the default and can be omitted
|
|
68
|
-
# defaults to "production".
|
|
69
|
-
environment="development",
|
|
70
68
|
)
|
|
71
69
|
|
|
72
70
|
response = client.search.perform()
|
|
@@ -88,8 +86,6 @@ from channel3_sdk import AsyncChannel3
|
|
|
88
86
|
|
|
89
87
|
client = AsyncChannel3(
|
|
90
88
|
api_key=os.environ.get("CHANNEL3_API_KEY"), # This is the default and can be omitted
|
|
91
|
-
# defaults to "production".
|
|
92
|
-
environment="development",
|
|
93
89
|
)
|
|
94
90
|
|
|
95
91
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
channel3_sdk/__init__.py,sha256=
|
|
1
|
+
channel3_sdk/__init__.py,sha256=nOTgOOKTvfpQQucIrY96K6qCUy_eWxaKomxguT8S1cU,2649
|
|
2
2
|
channel3_sdk/_base_client.py,sha256=jAazpJA7xqOW0adz0t6NQqnCdA2car1Ltt-hHRWkJO4,67053
|
|
3
|
-
channel3_sdk/_client.py,sha256=
|
|
3
|
+
channel3_sdk/_client.py,sha256=gxCXsZYFLhwm1fLnQI9kFdiRXJqnTKFbk7sVxZqUoaI,18693
|
|
4
4
|
channel3_sdk/_compat.py,sha256=DQBVORjFb33zch24jzkhM14msvnzY7mmSmgDLaVFUM8,6562
|
|
5
5
|
channel3_sdk/_constants.py,sha256=S14PFzyN9-I31wiV7SmIlL5Ga0MLHxdvegInGdXH7tM,462
|
|
6
6
|
channel3_sdk/_exceptions.py,sha256=84j5sMEvg1Y-Zm8O67uKc4VKDZyMyT7UNYql5WGxCQU,3224
|
|
@@ -11,7 +11,7 @@ channel3_sdk/_resource.py,sha256=GoE4cbZQQeB-svaapj3Xu4BObqkjwbzcd4HbXcti-oc,111
|
|
|
11
11
|
channel3_sdk/_response.py,sha256=fQfICgXh4GiLeIvsMrIRiUo9WIML1AWVhk3D-qkJiVw,28846
|
|
12
12
|
channel3_sdk/_streaming.py,sha256=q4zuYRWOVScdu0XFwgZle68N1jzSwFd8SbBE4js9hYg,10108
|
|
13
13
|
channel3_sdk/_types.py,sha256=vyVmsT14j89c0NFuWlM9KCoRdE1QHrmAGPYZg0fNF3A,7302
|
|
14
|
-
channel3_sdk/_version.py,sha256=
|
|
14
|
+
channel3_sdk/_version.py,sha256=OPYrAQJTJx2HOj_uFwaM-FVmDsSOGrIiHhguCFF6PaY,164
|
|
15
15
|
channel3_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
16
|
channel3_sdk/_utils/__init__.py,sha256=7fch0GT9zpNnErbciSpUNa-SjTxxjY6kxHxKMOM4AGs,2305
|
|
17
17
|
channel3_sdk/_utils/_compat.py,sha256=D8gtAvjJQrDWt9upS0XaG9Rr5l1QhiAx_I_1utT_tt0,1195
|
|
@@ -43,7 +43,7 @@ channel3_sdk/types/product_retrieve_response.py,sha256=BJn6JCHfKDnVSbq02ddToT5gT
|
|
|
43
43
|
channel3_sdk/types/search_perform_params.py,sha256=WdAOyOCweXMs2hH-q3ts6fw9VNq7cTSq1q-wrWAPuyE,1594
|
|
44
44
|
channel3_sdk/types/search_perform_response.py,sha256=Px4_wJB9YUUxLoXZzWPpMOjh62No7lWzcenll1K-NnE,721
|
|
45
45
|
channel3_sdk/types/variant.py,sha256=QcmXSluhHFVXT0QMhITG4iZvS-hl1ngoIev1nswUINc,226
|
|
46
|
-
channel3_sdk-2.
|
|
47
|
-
channel3_sdk-2.
|
|
48
|
-
channel3_sdk-2.
|
|
49
|
-
channel3_sdk-2.
|
|
46
|
+
channel3_sdk-2.2.0.dist-info/METADATA,sha256=hcbRXPApPOCjh_oJ5cKb2BoWpG1pWcYh6FWgEXhTKJo,13637
|
|
47
|
+
channel3_sdk-2.2.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
48
|
+
channel3_sdk-2.2.0.dist-info/licenses/LICENSE,sha256=pSFglIc4-SNY4qmMqUbuM9ZbSEb8pp67mDMyRI2dN2I,11338
|
|
49
|
+
channel3_sdk-2.2.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|