moovio_sdk 0.8.2__py3-none-any.whl → 0.10.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.
moovio_sdk/_version.py CHANGED
@@ -3,10 +3,10 @@
3
3
  import importlib.metadata
4
4
 
5
5
  __title__: str = "moovio_sdk"
6
- __version__: str = "0.8.2"
6
+ __version__: str = "0.10.0"
7
7
  __openapi_doc_version__: str = "latest"
8
- __gen_version__: str = "2.597.9"
9
- __user_agent__: str = "speakeasy-sdk/python 0.8.2 2.597.9 latest moovio_sdk"
8
+ __gen_version__: str = "2.610.0"
9
+ __user_agent__: str = "speakeasy-sdk/python 0.10.0 2.610.0 latest moovio_sdk"
10
10
 
11
11
  try:
12
12
  if __package__ is not None:
moovio_sdk/cards.py CHANGED
@@ -160,7 +160,7 @@ class Cards(BaseSDK):
160
160
  result=utils.unmarshal_json(http_res.text, components.Card),
161
161
  headers=utils.get_response_headers(http_res.headers),
162
162
  )
163
- if utils.match_response(http_res, ["400", "409"], "application/json"):
163
+ if utils.match_response(http_res, "400", "application/json"):
164
164
  response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
165
165
  raise errors.GenericError(data=response_data)
166
166
  if utils.match_response(http_res, "422", "application/json"):
@@ -168,7 +168,7 @@ class Cards(BaseSDK):
168
168
  http_res.text, errors.LinkCardErrorData
169
169
  )
170
170
  raise errors.LinkCardError(data=response_data)
171
- if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
171
+ if utils.match_response(http_res, ["401", "403", "404", "409", "429"], "*"):
172
172
  http_res_text = utils.stream_to_text(http_res)
173
173
  raise errors.APIError(
174
174
  "API error occurred", http_res.status_code, http_res_text, http_res
@@ -348,7 +348,7 @@ class Cards(BaseSDK):
348
348
  result=utils.unmarshal_json(http_res.text, components.Card),
349
349
  headers=utils.get_response_headers(http_res.headers),
350
350
  )
351
- if utils.match_response(http_res, ["400", "409"], "application/json"):
351
+ if utils.match_response(http_res, "400", "application/json"):
352
352
  response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
353
353
  raise errors.GenericError(data=response_data)
354
354
  if utils.match_response(http_res, "422", "application/json"):
@@ -356,7 +356,7 @@ class Cards(BaseSDK):
356
356
  http_res.text, errors.LinkCardErrorData
357
357
  )
358
358
  raise errors.LinkCardError(data=response_data)
359
- if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
359
+ if utils.match_response(http_res, ["401", "403", "404", "409", "429"], "*"):
360
360
  http_res_text = await utils.stream_to_text_async(http_res)
361
361
  raise errors.APIError(
362
362
  "API error occurred", http_res.status_code, http_res_text, http_res
moovio_sdk/httpclient.py CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  # pyright: reportReturnType = false
4
4
  import asyncio
5
- from concurrent.futures import ThreadPoolExecutor
6
5
  from typing_extensions import Protocol, runtime_checkable
7
6
  import httpx
8
7
  from typing import Any, Optional, Union
@@ -116,21 +115,12 @@ def close_clients(
116
115
  pass
117
116
 
118
117
  if async_client is not None and not async_client_supplied:
119
- is_async = False
120
118
  try:
121
- asyncio.get_running_loop()
122
- is_async = True
119
+ loop = asyncio.get_running_loop()
120
+ asyncio.run_coroutine_threadsafe(async_client.aclose(), loop)
123
121
  except RuntimeError:
124
- pass
125
-
126
- try:
127
- # If this function is called in an async loop then start another
128
- # loop in a separate thread to close the async http client.
129
- if is_async:
130
- with ThreadPoolExecutor(max_workers=1) as executor:
131
- future = executor.submit(asyncio.run, async_client.aclose())
132
- future.result()
133
- else:
122
+ try:
134
123
  asyncio.run(async_client.aclose())
135
- except Exception:
136
- pass
124
+ except RuntimeError:
125
+ # best effort
126
+ pass
@@ -1,4 +1,3 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  # package
4
-