http-content-parser 0.0.12__tar.gz → 0.0.14__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.
- {http_content_parser-0.0.12 → http_content_parser-0.0.14}/PKG-INFO +14 -1
- http_content_parser-0.0.14/README.md +16 -0
- {http_content_parser-0.0.12 → http_content_parser-0.0.14}/pyproject.toml +1 -1
- {http_content_parser-0.0.12 → http_content_parser-0.0.14}/src/http_content_parser/curl_parser.py +4 -10
- {http_content_parser-0.0.12 → http_content_parser-0.0.14}/tests/test_curl.py +6 -2
- http_content_parser-0.0.12/README.md +0 -3
- {http_content_parser-0.0.12 → http_content_parser-0.0.14}/.gitignore +0 -0
- {http_content_parser-0.0.12 → http_content_parser-0.0.14}/LICENSE +0 -0
- {http_content_parser-0.0.12 → http_content_parser-0.0.14}/requirements.txt +0 -0
- {http_content_parser-0.0.12 → http_content_parser-0.0.14}/src/http_content_parser/__init__.py +0 -0
- {http_content_parser-0.0.12 → http_content_parser-0.0.14}/src/http_content_parser/generate_api_file.py +0 -0
- {http_content_parser-0.0.12 → http_content_parser-0.0.14}/src/http_content_parser/openapi_parser.py +0 -0
- {http_content_parser-0.0.12 → http_content_parser-0.0.14}/src/http_content_parser/param_util.py +0 -0
- {http_content_parser-0.0.12 → http_content_parser-0.0.14}/src/http_content_parser/postman_parser.py +0 -0
- {http_content_parser-0.0.12 → http_content_parser-0.0.14}/src/http_content_parser/req_data.py +0 -0
- {http_content_parser-0.0.12 → http_content_parser-0.0.14}/src/http_content_parser/swagger2_parser.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: http_content_parser
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.14
|
|
4
4
|
Summary: parse http's payload and response
|
|
5
5
|
Author-email: max su <suleiabc@gmail.com>
|
|
6
6
|
License-File: LICENSE
|
|
@@ -13,3 +13,16 @@ Description-Content-Type: text/markdown
|
|
|
13
13
|
# HttpParser Package
|
|
14
14
|
|
|
15
15
|
This is a http content parser package.
|
|
16
|
+
|
|
17
|
+
## build package
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
python3 -m build
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## upload to pypi
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
rm -f dist/*
|
|
27
|
+
python3 -m twine upload dist/*
|
|
28
|
+
```
|
{http_content_parser-0.0.12 → http_content_parser-0.0.14}/src/http_content_parser/curl_parser.py
RENAMED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# -*- coding: UTF-8 -*-
|
|
2
|
+
import re
|
|
2
3
|
from urllib.parse import urlparse, parse_qs
|
|
3
4
|
|
|
4
5
|
|
|
@@ -94,10 +95,7 @@ class CurlParser(object):
|
|
|
94
95
|
line_i_list = lines_i_str.split(" '")
|
|
95
96
|
subs = str(line_i_list[1]).split(":")
|
|
96
97
|
if len(subs) > 1:
|
|
97
|
-
|
|
98
|
-
header[subs[0]] = (
|
|
99
|
-
subs[1].replace("'", "").replace("\\\n", "").replace(" ", "")
|
|
100
|
-
)
|
|
98
|
+
header[subs[0]] = subs[1][1:].replace("'", "").replace(" \\\n", "")
|
|
101
99
|
else:
|
|
102
100
|
header[subs[0]] = ""
|
|
103
101
|
elif "--data-raw" in lines_i_str or "--data" in lines_i_str:
|
|
@@ -108,12 +106,8 @@ class CurlParser(object):
|
|
|
108
106
|
curl_data = line_i_list[1]
|
|
109
107
|
else:
|
|
110
108
|
curl_data = line_i_list[0]
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
.replace(" ", "")
|
|
114
|
-
.replace("\\\n", "")
|
|
115
|
-
.replace("\n", "")
|
|
116
|
-
)
|
|
109
|
+
body = re.sub( r"\n\s*", "", curl_data.replace(" \\\n", ""))
|
|
110
|
+
req_data["body"] = body[:-1]
|
|
117
111
|
|
|
118
112
|
if not req_data.get("method"):
|
|
119
113
|
req_data["method"] = "post"
|
|
@@ -13,9 +13,13 @@ class TestCases:
|
|
|
13
13
|
# with open("./postman.json", "r") as f:
|
|
14
14
|
# json_dict = json.load(f)
|
|
15
15
|
# gaf.produce_api_yaml_for_postman(json_dict, "./test.yaml")
|
|
16
|
-
curl_file = '/Users/lei.susl/Desktop/test1/iac
|
|
16
|
+
curl_file = '/Users/lei.susl/Desktop/test1/iac-dispatcher/tmp2'
|
|
17
17
|
res = gaf.convert_curl_data_to_model(curl_file_path=curl_file)
|
|
18
|
-
|
|
18
|
+
for r in res:
|
|
19
|
+
print('body is: \n')
|
|
20
|
+
print(r.body)
|
|
21
|
+
print('header is: \n')
|
|
22
|
+
print(r.header)
|
|
19
23
|
|
|
20
24
|
|
|
21
25
|
def test_for(self):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{http_content_parser-0.0.12 → http_content_parser-0.0.14}/src/http_content_parser/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{http_content_parser-0.0.12 → http_content_parser-0.0.14}/src/http_content_parser/openapi_parser.py
RENAMED
|
File without changes
|
{http_content_parser-0.0.12 → http_content_parser-0.0.14}/src/http_content_parser/param_util.py
RENAMED
|
File without changes
|
{http_content_parser-0.0.12 → http_content_parser-0.0.14}/src/http_content_parser/postman_parser.py
RENAMED
|
File without changes
|
{http_content_parser-0.0.12 → http_content_parser-0.0.14}/src/http_content_parser/req_data.py
RENAMED
|
File without changes
|
{http_content_parser-0.0.12 → http_content_parser-0.0.14}/src/http_content_parser/swagger2_parser.py
RENAMED
|
File without changes
|