wexample-api 6.4.0__tar.gz → 6.5.0__tar.gz
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.
- {wexample_api-6.4.0 → wexample_api-6.5.0}/PKG-INFO +6 -6
- {wexample_api-6.4.0 → wexample_api-6.5.0}/README.md +3 -3
- {wexample_api-6.4.0 → wexample_api-6.5.0}/pyproject.toml +3 -3
- {wexample_api-6.4.0 → wexample_api-6.5.0}/src/wexample_api/common/abstract_gateway.py +13 -7
- {wexample_api-6.4.0 → wexample_api-6.5.0}/src/wexample_api/__init__.py +0 -0
- {wexample_api-6.4.0 → wexample_api-6.5.0}/src/wexample_api/__pycache__/__init__.py +0 -0
- {wexample_api-6.4.0 → wexample_api-6.5.0}/src/wexample_api/common/__init__.py +0 -0
- {wexample_api-6.4.0 → wexample_api-6.5.0}/src/wexample_api/common/__pycache__/__init__.py +0 -0
- {wexample_api-6.4.0 → wexample_api-6.5.0}/src/wexample_api/common/http_request_payload.py +0 -0
- {wexample_api-6.4.0 → wexample_api-6.5.0}/src/wexample_api/const/__init__.py +0 -0
- {wexample_api-6.4.0 → wexample_api-6.5.0}/src/wexample_api/const/__pycache__/__init__.py +0 -0
- {wexample_api-6.4.0 → wexample_api-6.5.0}/src/wexample_api/const/http.py +0 -0
- {wexample_api-6.4.0 → wexample_api-6.5.0}/src/wexample_api/demo/__init__.py +0 -0
- {wexample_api-6.4.0 → wexample_api-6.5.0}/src/wexample_api/demo/demo_simple_gateway.py +0 -0
- {wexample_api-6.4.0 → wexample_api-6.5.0}/src/wexample_api/enums/__init__.py +0 -0
- {wexample_api-6.4.0 → wexample_api-6.5.0}/src/wexample_api/enums/__pycache__/__init__.py +0 -0
- {wexample_api-6.4.0 → wexample_api-6.5.0}/src/wexample_api/enums/http.py +0 -0
- {wexample_api-6.4.0 → wexample_api-6.5.0}/src/wexample_api/errors/__init__.py +0 -0
- {wexample_api-6.4.0 → wexample_api-6.5.0}/src/wexample_api/errors/gateway_authentication_error.py +0 -0
- {wexample_api-6.4.0 → wexample_api-6.5.0}/src/wexample_api/errors/gateway_connexion_error.py +0 -0
- {wexample_api-6.4.0 → wexample_api-6.5.0}/src/wexample_api/middleware/__init__.py +0 -0
- {wexample_api-6.4.0 → wexample_api-6.5.0}/src/wexample_api/models/__init__.py +0 -0
- {wexample_api-6.4.0 → wexample_api-6.5.0}/src/wexample_api/py.typed +0 -0
- {wexample_api-6.4.0 → wexample_api-6.5.0}/tests/common/__init__.py +0 -0
- {wexample_api-6.4.0 → wexample_api-6.5.0}/tests/common/test_http_request_payload.py +0 -0
- {wexample_api-6.4.0 → wexample_api-6.5.0}/tests/demo/__init__.py +0 -0
- {wexample_api-6.4.0 → wexample_api-6.5.0}/tests/demo/test_demo_simple_gateway.py +0 -0
- {wexample_api-6.4.0 → wexample_api-6.5.0}/tests/new_architecture/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: wexample-api
|
|
3
|
-
Version: 6.
|
|
3
|
+
Version: 6.5.0
|
|
4
4
|
Summary: Some python basic helpers for apis.
|
|
5
5
|
Author-Email: weeger <contact@wexample.com>
|
|
6
6
|
License: MIT
|
|
@@ -12,8 +12,8 @@ Requires-Python: >=3.10
|
|
|
12
12
|
Requires-Dist: attrs>=23.1.0
|
|
13
13
|
Requires-Dist: cattrs>=23.1.0
|
|
14
14
|
Requires-Dist: requests
|
|
15
|
-
Requires-Dist: wexample-helpers>=
|
|
16
|
-
Requires-Dist: wexample-prompt>=13.
|
|
15
|
+
Requires-Dist: wexample-helpers>=17.0.0
|
|
16
|
+
Requires-Dist: wexample-prompt>=13.3.0
|
|
17
17
|
Provides-Extra: dev
|
|
18
18
|
Requires-Dist: pytest; extra == "dev"
|
|
19
19
|
Requires-Dist: pytest-cov; extra == "dev"
|
|
@@ -21,7 +21,7 @@ Description-Content-Type: text/markdown
|
|
|
21
21
|
|
|
22
22
|
# api
|
|
23
23
|
|
|
24
|
-
Version: 6.
|
|
24
|
+
Version: 6.5.0
|
|
25
25
|
|
|
26
26
|
Some python basic helpers for apis.
|
|
27
27
|
|
|
@@ -104,8 +104,8 @@ Visit the [Wexample Suite documentation](https://docs.wexample.com) for the comp
|
|
|
104
104
|
- attrs: >=23.1.0
|
|
105
105
|
- cattrs: >=23.1.0
|
|
106
106
|
- requests:
|
|
107
|
-
- wexample-helpers: >=
|
|
108
|
-
- wexample-prompt: >=13.
|
|
107
|
+
- wexample-helpers: >=17.0.0
|
|
108
|
+
- wexample-prompt: >=13.3.0
|
|
109
109
|
|
|
110
110
|
## Versioning & Compatibility Policy
|
|
111
111
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# api
|
|
2
2
|
|
|
3
|
-
Version: 6.
|
|
3
|
+
Version: 6.5.0
|
|
4
4
|
|
|
5
5
|
Some python basic helpers for apis.
|
|
6
6
|
|
|
@@ -83,8 +83,8 @@ Visit the [Wexample Suite documentation](https://docs.wexample.com) for the comp
|
|
|
83
83
|
- attrs: >=23.1.0
|
|
84
84
|
- cattrs: >=23.1.0
|
|
85
85
|
- requests:
|
|
86
|
-
- wexample-helpers: >=
|
|
87
|
-
- wexample-prompt: >=13.
|
|
86
|
+
- wexample-helpers: >=17.0.0
|
|
87
|
+
- wexample-prompt: >=13.3.0
|
|
88
88
|
|
|
89
89
|
## Versioning & Compatibility Policy
|
|
90
90
|
|
|
@@ -6,7 +6,7 @@ build-backend = "pdm.backend"
|
|
|
6
6
|
|
|
7
7
|
[project]
|
|
8
8
|
name = "wexample-api"
|
|
9
|
-
version = "6.
|
|
9
|
+
version = "6.5.0"
|
|
10
10
|
description = "Some python basic helpers for apis."
|
|
11
11
|
authors = [
|
|
12
12
|
{ name = "weeger", email = "contact@wexample.com" },
|
|
@@ -21,8 +21,8 @@ dependencies = [
|
|
|
21
21
|
"attrs>=23.1.0",
|
|
22
22
|
"cattrs>=23.1.0",
|
|
23
23
|
"requests",
|
|
24
|
-
"wexample-helpers>=
|
|
25
|
-
"wexample-prompt>=13.
|
|
24
|
+
"wexample-helpers>=17.0.0",
|
|
25
|
+
"wexample-prompt>=13.3.0",
|
|
26
26
|
]
|
|
27
27
|
|
|
28
28
|
[project.readme]
|
|
@@ -24,6 +24,14 @@ if TYPE_CHECKING:
|
|
|
24
24
|
from wexample_api.common.http_request_payload import HttpRequestPayload
|
|
25
25
|
from wexample_api.enums.http import Header
|
|
26
26
|
|
|
27
|
+
_RAW_BODY_CONTENT_TYPES = frozenset(
|
|
28
|
+
{
|
|
29
|
+
ContentType.FORM_URLENCODED.value,
|
|
30
|
+
ContentType.OCTET_STREAM.value,
|
|
31
|
+
ContentType.TEXT.value,
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
|
|
27
35
|
|
|
28
36
|
@base_class
|
|
29
37
|
class AbstractGateway(
|
|
@@ -238,11 +246,7 @@ class AbstractGateway(
|
|
|
238
246
|
if files:
|
|
239
247
|
request_kwargs["data"] = data or {}
|
|
240
248
|
request_kwargs["files"] = files
|
|
241
|
-
elif content_type in
|
|
242
|
-
ContentType.FORM_URLENCODED.value,
|
|
243
|
-
ContentType.OCTET_STREAM.value,
|
|
244
|
-
ContentType.TEXT.value,
|
|
245
|
-
}:
|
|
249
|
+
elif content_type in _RAW_BODY_CONTENT_TYPES:
|
|
246
250
|
request_kwargs["data"] = data
|
|
247
251
|
else:
|
|
248
252
|
request_kwargs["json"] = data
|
|
@@ -359,8 +363,10 @@ class AbstractGateway(
|
|
|
359
363
|
return raw.split(";", 1)[0].strip().lower() or None
|
|
360
364
|
|
|
361
365
|
def _handle_rate_limiting(self) -> None:
|
|
366
|
+
now = time.time()
|
|
362
367
|
if self.last_request_time is not None:
|
|
363
|
-
elapsed =
|
|
368
|
+
elapsed = now - self.last_request_time
|
|
364
369
|
if elapsed < self.rate_limit_delay:
|
|
365
370
|
time.sleep(self.rate_limit_delay - elapsed)
|
|
366
|
-
|
|
371
|
+
now = time.time()
|
|
372
|
+
self.last_request_time = now
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{wexample_api-6.4.0 → wexample_api-6.5.0}/src/wexample_api/errors/gateway_authentication_error.py
RENAMED
|
File without changes
|
{wexample_api-6.4.0 → wexample_api-6.5.0}/src/wexample_api/errors/gateway_connexion_error.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|