shopware-api-client 1.0.105__py3-none-any.whl → 1.0.107__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 shopware-api-client might be problematic. Click here for more details.

@@ -127,7 +127,7 @@ class ClientBase:
127
127
  headers = self._get_headers()
128
128
  headers.update(kwargs.pop("headers", {}))
129
129
 
130
- retry_wait_base = int(kwargs.pop("retriy_wait_base", 2))
130
+ retry_wait_base = int(kwargs.pop("retry_wait_base", 2))
131
131
  retries = int(kwargs.pop("retries", 0))
132
132
  retry_errors = tuple(
133
133
  kwargs.pop("retry_errors", [SWAPIInternalServerError, SWAPIServiceUnavailable, SWAPIGatewayTimeout])
@@ -146,16 +146,20 @@ class ClientBase:
146
146
  await asyncio.sleep(2**retry_count)
147
147
  retry_count += 1
148
148
  continue
149
-
150
- if response.status_code >= 400 and response.status_code != 429:
149
+ if response.status_code == 429:
150
+ # directly raise 429
151
+ error: SWAPIError = SWAPIError.from_response(response)
152
+ raise error
153
+ elif response.status_code >= 400:
154
+ # retry other failure codes
151
155
  try:
152
156
  errors: list = response.json().get("errors")
153
157
  # ensure `errors` attribute is a list/tuple, fallback to from_response if not
154
158
  if not isinstance(errors, (list, tuple)):
155
159
  raise ValueError("`errors` attribute in json not a list/tuple!")
156
160
 
157
- error: SWAPIError | SWAPIErrorList = SWAPIError.from_errors(errors)
158
- except ValueError:
161
+ error: SWAPIError | SWAPIErrorList = SWAPIError.from_errors(errors) # type: ignore
162
+ except (json.JSONDecodeError, ValueError):
159
163
  error: SWAPIError | SWAPIErrorList = SWAPIError.from_response(response) # type: ignore
160
164
 
161
165
  if isinstance(error, SWAPIErrorList) and len(error.errors) == 1:
@@ -95,7 +95,7 @@ class SWAPIError(SWAPIException):
95
95
  @classmethod
96
96
  def from_response(cls, response: Response) -> "SWAPIError":
97
97
  exception_class = cls.get_exception_class(response.status_code)
98
- response.headers["requested-url"] = response.request.url
98
+ response.headers["requested-url"] = str(response.request.url)
99
99
  return exception_class(
100
100
  status=response.status_code,
101
101
  title=response.reason_phrase,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: shopware-api-client
3
- Version: 1.0.105
3
+ Version: 1.0.107
4
4
  Summary: An api client for the Shopware API
5
5
  License: MIT
6
6
  Keywords: shopware,api,client
@@ -1,5 +1,5 @@
1
1
  shopware_api_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- shopware_api_client/base.py,sha256=i1iKwQeR8XBDbo0xXJdXXOaWvxyw0GimI8RHNjR1KlY,25099
2
+ shopware_api_client/base.py,sha256=8KrOSxlFXDzkxvAj9YsjZhuEo07ZcXEvK3UvgZxGzZI,25331
3
3
  shopware_api_client/client.py,sha256=vkTZ8WLIu0Q3_73gXvidkTSpMJlWsJUjFyhDY2f2ISM,7583
4
4
  shopware_api_client/config.py,sha256=HStgfQcClpo_aqaTRDrqdTUjqSGPFkIMjrPwSruVnM8,1565
5
5
  shopware_api_client/endpoints/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -105,10 +105,10 @@ shopware_api_client/endpoints/store/__init__.py,sha256=LE_GL4jYVGrRdp6M1cPURI-UJ
105
105
  shopware_api_client/endpoints/store/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
106
106
  shopware_api_client/endpoints/store/core/address.py,sha256=Tm7ri-i0zhyt4LVEHaQy3xEvjapCCPRsYAp5lOCDOew,2774
107
107
  shopware_api_client/endpoints/store/core/cart.py,sha256=34eNwuv7H9WZUtJGf4TkTGHiGynDT6xeAt0gIl7V4KI,2584
108
- shopware_api_client/exceptions.py,sha256=wVLAdXegQA9Zqlw_Yh4r8o7R5M_b0kMWGEJT8O1CqCY,4524
108
+ shopware_api_client/exceptions.py,sha256=KnOxav3iBPFfL3DVeURpaP2-lVHNDtiOt8jcmeZgxY8,4529
109
109
  shopware_api_client/logging.py,sha256=4QSTK1vcdBew4shvLG-fm-xDOlddhOZeyb5T9Og0fSA,251
110
110
  shopware_api_client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
111
- shopware_api_client-1.0.105.dist-info/LICENSE,sha256=qTihFhbGE2ZJJ7Byc9hnEYBY33yDK2Jw87SpAm0IKUs,1107
112
- shopware_api_client-1.0.105.dist-info/METADATA,sha256=_d1--GGVad9UVudtS3X-7bptcwQQ1-Et85M3IaTSVkI,22659
113
- shopware_api_client-1.0.105.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
114
- shopware_api_client-1.0.105.dist-info/RECORD,,
111
+ shopware_api_client-1.0.107.dist-info/LICENSE,sha256=qTihFhbGE2ZJJ7Byc9hnEYBY33yDK2Jw87SpAm0IKUs,1107
112
+ shopware_api_client-1.0.107.dist-info/METADATA,sha256=-kfmkjiQsLqvwM9y4QoeNCnt9qpows2Pg_h8uLbOUd4,22659
113
+ shopware_api_client-1.0.107.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
114
+ shopware_api_client-1.0.107.dist-info/RECORD,,