curlify3 0.2__tar.gz → 0.4__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.
- {curlify3-0.2 → curlify3-0.4}/PKG-INFO +3 -2
- {curlify3-0.2 → curlify3-0.4}/README.md +2 -1
- {curlify3-0.2 → curlify3-0.4}/curlify3/__init__.py +1 -1
- {curlify3-0.2 → curlify3-0.4}/curlify3/_curl.py +2 -4
- curlify3-0.4/curlify3/_req_aiohttp.py +15 -0
- {curlify3-0.2 → curlify3-0.4}/curlify3/_req_httpx.py +1 -1
- {curlify3-0.2 → curlify3-0.4}/curlify3/_utils.py +6 -0
- {curlify3-0.2 → curlify3-0.4}/pyproject.toml +3 -3
- {curlify3-0.2 → curlify3-0.4}/curlify3/_base.py +0 -0
- {curlify3-0.2 → curlify3-0.4}/curlify3/_req_requests.py +0 -0
- {curlify3-0.2 → curlify3-0.4}/curlify3/_req_starlette.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: curlify3
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4
|
|
4
4
|
Summary: yet another library to convert request object to curl command
|
|
5
5
|
Home-page: https://github.com/shpaker/curlify3
|
|
6
6
|
Author: A.Shpak
|
|
@@ -20,10 +20,11 @@ Description-Content-Type: text/markdown
|
|
|
20
20
|
[](https://pypi.python.org/pypi/curlify3)
|
|
21
21
|
[](https://pypi.python.org/pypi/curlify3)
|
|
22
22
|
|
|
23
|
-
### Support request's objects
|
|
23
|
+
### Support request's objects from:
|
|
24
24
|
|
|
25
25
|
- requests
|
|
26
26
|
- httpx
|
|
27
|
+
- aiohttp server
|
|
27
28
|
- starlette/fastapi
|
|
28
29
|
|
|
29
30
|
## Installation
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
[](https://pypi.python.org/pypi/curlify3)
|
|
4
4
|
[](https://pypi.python.org/pypi/curlify3)
|
|
5
5
|
|
|
6
|
-
### Support request's objects
|
|
6
|
+
### Support request's objects from:
|
|
7
7
|
|
|
8
8
|
- requests
|
|
9
9
|
- httpx
|
|
10
|
+
- aiohttp server
|
|
10
11
|
- starlette/fastapi
|
|
11
12
|
|
|
12
13
|
## Installation
|
|
@@ -29,6 +29,7 @@ def make_curl_cookies(cookies):
|
|
|
29
29
|
|
|
30
30
|
def make_multipart_curl_args(body):
|
|
31
31
|
body_parts = []
|
|
32
|
+
body = body.encode() if isinstance(body, str) else body
|
|
32
33
|
for matched in MULTIPART_FORM_DATA.finditer(body):
|
|
33
34
|
groups = matched.groups()
|
|
34
35
|
body_parts.append(f"-F '{groups[0].decode()}={groups[1].decode()}'")
|
|
@@ -38,10 +39,7 @@ def make_multipart_curl_args(body):
|
|
|
38
39
|
return " ".join(body_parts)
|
|
39
40
|
|
|
40
41
|
|
|
41
|
-
def make_curl_body(
|
|
42
|
-
body,
|
|
43
|
-
headers,
|
|
44
|
-
):
|
|
42
|
+
def make_curl_body(body, headers):
|
|
45
43
|
if "multipart" in headers.get("content-type", ""):
|
|
46
44
|
return make_multipart_curl_args(body)
|
|
47
45
|
if not body:
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from aiohttp import web
|
|
2
|
+
|
|
3
|
+
from curlify3._base import AsyncBaseRequestData
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class AiohttpServerRequest(AsyncBaseRequestData):
|
|
7
|
+
_instance_of = web.Request
|
|
8
|
+
|
|
9
|
+
async def body(self):
|
|
10
|
+
data = await self._request.read()
|
|
11
|
+
try:
|
|
12
|
+
return data.decode()
|
|
13
|
+
except UnicodeDecodeError:
|
|
14
|
+
pass
|
|
15
|
+
return data
|
|
@@ -22,6 +22,12 @@ with suppress(ImportError):
|
|
|
22
22
|
_REQUEST_DATA_CLASSES_ASYNC.append(AsyncHttpxRequest)
|
|
23
23
|
|
|
24
24
|
|
|
25
|
+
with suppress(ImportError):
|
|
26
|
+
from curlify3._req_aiohttp import AiohttpServerRequest
|
|
27
|
+
|
|
28
|
+
_REQUEST_DATA_CLASSES_ASYNC.append(AiohttpServerRequest)
|
|
29
|
+
|
|
30
|
+
|
|
25
31
|
with suppress(ImportError):
|
|
26
32
|
from curlify3._req_starlette import StarletteRequest
|
|
27
33
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "curlify3"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.4"
|
|
4
4
|
description = "yet another library to convert request object to curl command"
|
|
5
5
|
authors = ["A.Shpak <aleksander.shpak.als@gmail.com>"]
|
|
6
6
|
readme = "README.md"
|
|
@@ -15,8 +15,8 @@ requests = "^2.32.3"
|
|
|
15
15
|
httpx = "^0.27.2"
|
|
16
16
|
fastapi = "^0.115.4"
|
|
17
17
|
isort = "^5.13.2"
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
aiohttp = "^3.10.10"
|
|
19
|
+
pytest-aiohttp = "^1.0.5"
|
|
20
20
|
pytest = "^8.3.3"
|
|
21
21
|
pytest-asyncio = "^0.24.0"
|
|
22
22
|
pytest-httpx = "^0.33.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|