mixpeek 0.20.4__py3-none-any.whl → 0.20.5__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.
mixpeek/_version.py CHANGED
@@ -3,10 +3,10 @@
3
3
  import importlib.metadata
4
4
 
5
5
  __title__: str = "mixpeek"
6
- __version__: str = "0.20.4"
6
+ __version__: str = "0.20.5"
7
7
  __openapi_doc_version__: str = "0.81"
8
- __gen_version__: str = "2.529.2"
9
- __user_agent__: str = "speakeasy-sdk/python 0.20.4 2.529.2 0.81 mixpeek"
8
+ __gen_version__: str = "2.531.0"
9
+ __user_agent__: str = "speakeasy-sdk/python 0.20.5 2.531.0 0.81 mixpeek"
10
10
 
11
11
  try:
12
12
  if __package__ is not None:
mixpeek/basesdk.py CHANGED
@@ -227,6 +227,10 @@ class BaseSDK:
227
227
  req.headers,
228
228
  get_body_content(req),
229
229
  )
230
+
231
+ if client is None:
232
+ raise ValueError("client is required")
233
+
230
234
  http_res = client.send(req, stream=stream)
231
235
  except Exception as e:
232
236
  _, e = self.sdk_configuration.get_hooks().after_error(
@@ -299,6 +303,10 @@ class BaseSDK:
299
303
  req.headers,
300
304
  get_body_content(req),
301
305
  )
306
+
307
+ if client is None:
308
+ raise ValueError("client is required")
309
+
302
310
  http_res = await client.send(req, stream=stream)
303
311
  except Exception as e:
304
312
  _, e = self.sdk_configuration.get_hooks().after_error(
mixpeek/httpclient.py CHANGED
@@ -94,7 +94,9 @@ class ClientOwner(Protocol):
94
94
  def close_clients(
95
95
  owner: ClientOwner,
96
96
  sync_client: Union[HttpClient, None],
97
+ sync_client_supplied: bool,
97
98
  async_client: Union[AsyncHttpClient, None],
99
+ async_client_supplied: bool,
98
100
  ) -> None:
99
101
  """
100
102
  A finalizer function that is meant to be used with weakref.finalize to close
@@ -107,13 +109,13 @@ def close_clients(
107
109
  owner.client = None
108
110
  owner.async_client = None
109
111
 
110
- if sync_client is not None:
112
+ if sync_client is not None and not sync_client_supplied:
111
113
  try:
112
114
  sync_client.close()
113
115
  except Exception:
114
116
  pass
115
117
 
116
- if async_client is not None:
118
+ if async_client is not None and not async_client_supplied:
117
119
  is_async = False
118
120
  try:
119
121
  asyncio.get_running_loop()
mixpeek/sdk.py CHANGED
@@ -73,15 +73,19 @@ class Mixpeek(BaseSDK):
73
73
  :param retry_config: The retry configuration to use for all supported methods
74
74
  :param timeout_ms: Optional request timeout applied to each operation in milliseconds
75
75
  """
76
+ client_supplied = True
76
77
  if client is None:
77
78
  client = httpx.Client()
79
+ client_supplied = False
78
80
 
79
81
  assert issubclass(
80
82
  type(client), HttpClient
81
83
  ), "The provided client must implement the HttpClient protocol."
82
84
 
85
+ async_client_supplied = True
83
86
  if async_client is None:
84
87
  async_client = httpx.AsyncClient()
88
+ async_client_supplied = False
85
89
 
86
90
  if debug_logger is None:
87
91
  debug_logger = get_default_logger()
@@ -111,7 +115,9 @@ class Mixpeek(BaseSDK):
111
115
  self,
112
116
  SDKConfiguration(
113
117
  client=client,
118
+ client_supplied=client_supplied,
114
119
  async_client=async_client,
120
+ async_client_supplied=async_client_supplied,
115
121
  globals=_globals,
116
122
  security=security,
117
123
  server_url=server_url,
@@ -126,7 +132,7 @@ class Mixpeek(BaseSDK):
126
132
 
127
133
  current_server_url, *_ = self.sdk_configuration.get_server_details()
128
134
  server_url, self.sdk_configuration.client = hooks.sdk_init(
129
- current_server_url, self.sdk_configuration.client
135
+ current_server_url, client
130
136
  )
131
137
  if current_server_url != server_url:
132
138
  self.sdk_configuration.server_url = server_url
@@ -139,7 +145,9 @@ class Mixpeek(BaseSDK):
139
145
  close_clients,
140
146
  cast(ClientOwner, self.sdk_configuration),
141
147
  self.sdk_configuration.client,
148
+ self.sdk_configuration.client_supplied,
142
149
  self.sdk_configuration.async_client,
150
+ self.sdk_configuration.async_client_supplied,
143
151
  )
144
152
 
145
153
  self._init_sdks()
@@ -165,9 +173,17 @@ class Mixpeek(BaseSDK):
165
173
  return self
166
174
 
167
175
  def __exit__(self, exc_type, exc_val, exc_tb):
168
- if self.sdk_configuration.client is not None:
176
+ if (
177
+ self.sdk_configuration.client is not None
178
+ and not self.sdk_configuration.client_supplied
179
+ ):
169
180
  self.sdk_configuration.client.close()
181
+ self.sdk_configuration.client = None
170
182
 
171
183
  async def __aexit__(self, exc_type, exc_val, exc_tb):
172
- if self.sdk_configuration.async_client is not None:
184
+ if (
185
+ self.sdk_configuration.async_client is not None
186
+ and not self.sdk_configuration.async_client_supplied
187
+ ):
173
188
  await self.sdk_configuration.async_client.aclose()
189
+ self.sdk_configuration.async_client = None
@@ -25,8 +25,10 @@ SERVERS = [
25
25
 
26
26
  @dataclass
27
27
  class SDKConfiguration:
28
- client: HttpClient
29
- async_client: AsyncHttpClient
28
+ client: Union[HttpClient, None]
29
+ client_supplied: bool
30
+ async_client: Union[AsyncHttpClient, None]
31
+ async_client_supplied: bool
30
32
  debug_logger: Logger
31
33
  globals: internal.Globals
32
34
  security: Optional[Union[models.Security, Callable[[], models.Security]]] = None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: mixpeek
3
- Version: 0.20.4
3
+ Version: 0.20.5
4
4
  Summary: Python Client SDK Generated by Speakeasy.
5
5
  Author: Speakeasy
6
6
  Requires-Python: >=3.9
@@ -131,6 +131,7 @@ Generally, the SDK will work well with most IDEs out of the box. However, when u
131
131
  from mixpeek import Mixpeek
132
132
  import os
133
133
 
134
+
134
135
  with Mixpeek(
135
136
  token=os.getenv("MIXPEEK_TOKEN", ""),
136
137
  ) as m_client:
@@ -151,6 +152,7 @@ from mixpeek import Mixpeek
151
152
  import os
152
153
 
153
154
  async def main():
155
+
154
156
  async with Mixpeek(
155
157
  token=os.getenv("MIXPEEK_TOKEN", ""),
156
158
  ) as m_client:
@@ -180,6 +182,7 @@ To authenticate with the API the `token` parameter must be set when initializing
180
182
  from mixpeek import Mixpeek
181
183
  import os
182
184
 
185
+
183
186
  with Mixpeek(
184
187
  token=os.getenv("MIXPEEK_TOKEN", ""),
185
188
  ) as m_client:
@@ -299,6 +302,7 @@ from mixpeek import Mixpeek
299
302
  from mixpeek.utils import BackoffStrategy, RetryConfig
300
303
  import os
301
304
 
305
+
302
306
  with Mixpeek(
303
307
  token=os.getenv("MIXPEEK_TOKEN", ""),
304
308
  ) as m_client:
@@ -317,6 +321,7 @@ from mixpeek import Mixpeek
317
321
  from mixpeek.utils import BackoffStrategy, RetryConfig
318
322
  import os
319
323
 
324
+
320
325
  with Mixpeek(
321
326
  retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False),
322
327
  token=os.getenv("MIXPEEK_TOKEN", ""),
@@ -359,6 +364,7 @@ When custom error responses are specified for an operation, the SDK may also rai
359
364
  from mixpeek import Mixpeek, models
360
365
  import os
361
366
 
367
+
362
368
  with Mixpeek(
363
369
  token=os.getenv("MIXPEEK_TOKEN", ""),
364
370
  ) as m_client:
@@ -395,6 +401,7 @@ The default server can be overridden globally by passing a URL to the `server_ur
395
401
  from mixpeek import Mixpeek
396
402
  import os
397
403
 
404
+
398
405
  with Mixpeek(
399
406
  server_url="https://api.mixpeek.com",
400
407
  token=os.getenv("MIXPEEK_TOKEN", ""),
@@ -500,6 +507,7 @@ The `Mixpeek` class implements the context manager protocol and registers a fina
500
507
  from mixpeek import Mixpeek
501
508
  import os
502
509
  def main():
510
+
503
511
  with Mixpeek(
504
512
  token=os.getenv("MIXPEEK_TOKEN", ""),
505
513
  ) as m_client:
@@ -508,6 +516,7 @@ def main():
508
516
 
509
517
  # Or when using async:
510
518
  async def amain():
519
+
511
520
  async with Mixpeek(
512
521
  token=os.getenv("MIXPEEK_TOKEN", ""),
513
522
  ) as m_client:
@@ -3,14 +3,14 @@ mixpeek/_hooks/__init__.py,sha256=p5J13DeYuISQyQWirjJAObHIf2VtIlOtFqnIpvjjVwk,11
3
3
  mixpeek/_hooks/registration.py,sha256=1QZB41w6If7I9dXiOSQx6dhSc6BPWrnI5Q5bMOr4iVA,624
4
4
  mixpeek/_hooks/sdkhooks.py,sha256=T0xbVPw8mvvFszHZlrZdtFrJBovAqE-JQfw4dS9Xi7Y,2495
5
5
  mixpeek/_hooks/types.py,sha256=YEJVwBkHXS0VhTpa_xr7IZdJM5DdEi7QKq_LDv-6A2o,2810
6
- mixpeek/_version.py,sha256=enNv9fmrl28On7xksU0xwxRu7D1u78tIJd9-BlaMF5I,456
6
+ mixpeek/_version.py,sha256=u4PqVVK9GA4NABI8eAWyWFRPDBDBqSyISaEc_lWlj3U,456
7
7
  mixpeek/assets.py,sha256=DnVKyR5-dsyyuCnzHn2s7EdRwCzg3qQidsJlqBxeCBA,79298
8
- mixpeek/basesdk.py,sha256=j_PZqE6WgIfx1cPCK5gAVn-rgPy9iLhUN5ELtefoEU0,11976
8
+ mixpeek/basesdk.py,sha256=qpFsPjn-FwedQiTfOScgF2VCWHRSPkd4TFH6GSlV4ww,12168
9
9
  mixpeek/collections.py,sha256=Aqn_lM4GClePKEdOnn43eD3iX0DBaRdwnkPte3MqTYU,51807
10
10
  mixpeek/featureextractors.py,sha256=_h44AFhY1QZ2vNZ1mp-IiwSjkpGcE3HFFYAmf_p8CpI,10138
11
11
  mixpeek/features.py,sha256=Uo72_WRDu5qpR4tbIsQ5Yn_sukp9aK9qTTjKd4xJUxI,61552
12
12
  mixpeek/health.py,sha256=7QjiR-IESq2mrYrx9x0sa1de3530cUDc7gUdWsc-Q6s,6976
13
- mixpeek/httpclient.py,sha256=N-D-srtDBykpfyVKacTY4upDGvNLqdWlEYqhJvta99E,4194
13
+ mixpeek/httpclient.py,sha256=lC-YQ7q4yiJGKElxBeb3aZnr-4aYxjgEpZ6roeXYlyg,4318
14
14
  mixpeek/ingestassets.py,sha256=Gj7NokeHKcs9dbthFAXMaFjiUJOiKOnfzoNSGo6Ketg,42062
15
15
  mixpeek/models/__init__.py,sha256=Gvyvq_f99L65JlfwafRkx_UpbaFwAK27DYEvVHSvzuc,31893
16
16
  mixpeek/models/actionusage.py,sha256=WAnnBVTeQ9j0dtIrubfyyJQwbBamxManfS8fc2OFNyo,324
@@ -172,8 +172,8 @@ mixpeek/models/videotranscriptionsettings.py,sha256=70EN-PX2QiQAQjDLYaV2coUCnVjR
172
172
  mixpeek/namespaces.py,sha256=deIc7GiPLwNg7ul0fUi3_cTpieByyeEQcyssDoCdHxQ,68298
173
173
  mixpeek/organizations.py,sha256=nAK1_uY5EbzIln54y6oZBQ3UtUj36uMs9EGH-a8QObg,47495
174
174
  mixpeek/py.typed,sha256=zrp19r0G21lr2yRiMC0f8MFkQFGj9wMpSbboePMg8KM,59
175
- mixpeek/sdk.py,sha256=j8NFfo1tsiiN6VmvmI53XcbeW4dHQgTocxBczCNaE08,6464
176
- mixpeek/sdkconfiguration.py,sha256=WDFDVblhsi547ZxDPEPR243zKLM1shTDSt9w3nporHc,1703
175
+ mixpeek/sdk.py,sha256=0cEGOP__er4xw02yZ7I14chphwYZQ7cc3giZoWySKPE,7075
176
+ mixpeek/sdkconfiguration.py,sha256=edo_sMUCQonuwfrmTs-hmOM3oO4-e6f2r_2__q4IMDM,1787
177
177
  mixpeek/tasks.py,sha256=h42XMf_kTU4Ka455GWFBQwo-L-YLM9BVfPu1GxO55jo,29222
178
178
  mixpeek/taxonomies.py,sha256=uDzCetUSEPtf8b7mChPv-R6RXeSpkAC_RUpvV4GIeY0,31173
179
179
  mixpeek/taxonomyentities.py,sha256=-5_Yjfd6JClRnwws1ouuS_dsvSpoMLAV78mUzIDpyEA,78268
@@ -195,6 +195,6 @@ mixpeek/utils/security.py,sha256=XoK-R2YMyZtVWQte7FoezfGJS-dea9jz4qQ7w5dwNWc,600
195
195
  mixpeek/utils/serializers.py,sha256=BSJT7kBOkNBFyP7KREyMoe14JGbgijD1M6AXFMbdmco,4924
196
196
  mixpeek/utils/url.py,sha256=BgGPgcTA6MRK4bF8fjP2dUopN3NzEzxWMXPBVg8NQUA,5254
197
197
  mixpeek/utils/values.py,sha256=CcaCXEa3xHhkUDROyXZocN8f0bdITftv9Y0P9lTf0YM,3517
198
- mixpeek-0.20.4.dist-info/METADATA,sha256=AFME0fDGRJYUDHj9f-UVoR2SPvc7RFAQMAWARbgATck,23243
199
- mixpeek-0.20.4.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
200
- mixpeek-0.20.4.dist-info/RECORD,,
198
+ mixpeek-0.20.5.dist-info/METADATA,sha256=jhrkuGfnRu03GfDS86iIVIrjxH320yj63DINpvttt74,23252
199
+ mixpeek-0.20.5.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
200
+ mixpeek-0.20.5.dist-info/RECORD,,