tina4-python 0.2.16__tar.gz → 0.2.18__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.
- {tina4_python-0.2.16 → tina4_python-0.2.18}/PKG-INFO +1 -1
- {tina4_python-0.2.16 → tina4_python-0.2.18}/pyproject.toml +1 -1
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/Request.py +4 -2
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/Router.py +3 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/Webserver.py +13 -10
- {tina4_python-0.2.16 → tina4_python-0.2.18}/README.md +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/Auth.py +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/Constant.py +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/Database.py +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/DatabaseResult.py +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/Debug.py +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/Env.py +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/Localization.py +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/Messages.py +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/Migration.py +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/Response.py +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/Session.py +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/ShellColors.py +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/Swagger.py +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/Template.py +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/__init__.py +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/messages.pot +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/public/css/readme.md +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/public/favicon.ico +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/public/images/403.png +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/public/images/404.png +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/public/images/logo.png +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/public/images/readme.md +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/public/js/readme.md +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/public/js/tina4helper.js +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/public/swagger/index.html +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/public/swagger/oauth2-redirect.html +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/templates/errors/403.twig +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/templates/errors/404.twig +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/templates/readme.md +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/translations/en/LC_MESSAGES/messages.mo +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/translations/en/LC_MESSAGES/messages.po +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/translations/fr/LC_MESSAGES/messages.mo +0 -0
- {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/translations/fr/LC_MESSAGES/messages.po +0 -0
|
@@ -9,7 +9,7 @@ class Request:
|
|
|
9
9
|
Request object to store parameters, headers, etc.
|
|
10
10
|
"""
|
|
11
11
|
|
|
12
|
-
def __init__(self, body=None, params=None, headers=None, request=None,
|
|
12
|
+
def __init__(self, body=None, params=None, headers=None, request=None, raw_data=None, raw_request=None, raw_content=None):
|
|
13
13
|
self.body = body if body is not None else None
|
|
14
14
|
self.params = params if params is not None else {}
|
|
15
15
|
self.headers = headers if headers is not None else {}
|
|
@@ -18,5 +18,7 @@ class Request:
|
|
|
18
18
|
self.cookies = {}
|
|
19
19
|
self.session = None
|
|
20
20
|
self.files = {}
|
|
21
|
-
self.
|
|
21
|
+
self.raw_data = raw_data if raw_data is not None else None
|
|
22
|
+
self.raw_request = raw_request if raw_request is not None else None
|
|
23
|
+
self.raw_content = raw_content if raw_content is not None else None
|
|
22
24
|
|
|
@@ -132,6 +132,9 @@ class Router:
|
|
|
132
132
|
Request.params = request["params"]
|
|
133
133
|
Request.body = request["body"] if "body" in request else None
|
|
134
134
|
Request.session = session
|
|
135
|
+
Request.raw_data = request["raw_data"] if "raw_data" in request else None
|
|
136
|
+
Request.raw_request = request["raw_request"] if "raw_request" in request else None
|
|
137
|
+
Request.raw_content = request["raw_content"] if "raw_content" in request else None
|
|
135
138
|
|
|
136
139
|
tina4_python.tina4_current_request = Request
|
|
137
140
|
old_stdout = sys.stdout # Memorize the default stdout stream
|
|
@@ -27,7 +27,7 @@ class Webserver:
|
|
|
27
27
|
|
|
28
28
|
async def get_content_body(self, content_length):
|
|
29
29
|
# get lines of content where at the end of the request
|
|
30
|
-
content = self.
|
|
30
|
+
content = self.content_raw
|
|
31
31
|
|
|
32
32
|
if "content-type" in self.lowercase_headers:
|
|
33
33
|
if self.lowercase_headers["content-type"] == "application/x-www-form-urlencoded":
|
|
@@ -111,7 +111,7 @@ class Webserver:
|
|
|
111
111
|
else:
|
|
112
112
|
body = None
|
|
113
113
|
|
|
114
|
-
request = {"params": params, "body": body, "
|
|
114
|
+
request = {"params": params, "body": body, "raw_data": self.request, "headers": self.lowercase_headers, "raw_request": self.request_raw, "raw_content": self.content_raw}
|
|
115
115
|
|
|
116
116
|
tina4_python.tina4_current_request = request
|
|
117
117
|
|
|
@@ -185,29 +185,31 @@ class Webserver:
|
|
|
185
185
|
content_length = int(lowercase_headers["content-length"])
|
|
186
186
|
count = 0
|
|
187
187
|
read_size = 64
|
|
188
|
-
|
|
189
|
-
while len(
|
|
188
|
+
content_data = b''
|
|
189
|
+
while len(content_data) < content_length:
|
|
190
190
|
read = await reader.read(read_size)
|
|
191
191
|
count += len(read)
|
|
192
|
+
content_data += read
|
|
192
193
|
raw_data += read
|
|
193
194
|
# print('COUNT', count, len(read))
|
|
194
|
-
if len(read) < read_size and len(
|
|
195
|
+
if len(read) < read_size and len(content_data) == content_length:
|
|
195
196
|
break
|
|
196
197
|
try:
|
|
197
|
-
content =
|
|
198
|
+
content = content_data.decode("utf-8")
|
|
198
199
|
except: # probably binary or multipart form?
|
|
199
|
-
content =
|
|
200
|
+
content = content_data
|
|
200
201
|
|
|
201
|
-
return protocol, headers, lowercase_headers, content, raw_data
|
|
202
|
+
return protocol, headers, lowercase_headers, content, raw_data, content_data
|
|
202
203
|
|
|
203
204
|
async def handle_client(self, reader, writer):
|
|
204
205
|
# Get the client request
|
|
205
|
-
protocol, headers_list, lowercase_headers, request,
|
|
206
|
+
protocol, headers_list, lowercase_headers, request, request_raw, content_raw = await self.get_data(reader)
|
|
206
207
|
# Strange blank request ?
|
|
207
208
|
if protocol == '':
|
|
208
209
|
return
|
|
209
210
|
# Decode the request
|
|
210
|
-
self.request_raw =
|
|
211
|
+
self.request_raw = request_raw
|
|
212
|
+
self.content_raw = content_raw
|
|
211
213
|
self.request = request
|
|
212
214
|
self.headers = headers_list
|
|
213
215
|
self.lowercase_headers = lowercase_headers
|
|
@@ -249,6 +251,7 @@ class Webserver:
|
|
|
249
251
|
writer.close()
|
|
250
252
|
|
|
251
253
|
def __init__(self, host_name, port):
|
|
254
|
+
self.content_raw = None
|
|
252
255
|
self.session = Session
|
|
253
256
|
self.cookies = {}
|
|
254
257
|
self.method = None
|
|
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
|
|
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
|
{tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/public/swagger/oauth2-redirect.html
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/translations/en/LC_MESSAGES/messages.mo
RENAMED
|
File without changes
|
{tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/translations/en/LC_MESSAGES/messages.po
RENAMED
|
File without changes
|
{tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/translations/fr/LC_MESSAGES/messages.mo
RENAMED
|
File without changes
|
{tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/translations/fr/LC_MESSAGES/messages.po
RENAMED
|
File without changes
|