Here are the examples of the python api microdot.Request taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
0
View Complete Implementation : microdot_asyncio.py
Copyright MIT License
Author : miguelgrinberg
Copyright MIT License
Author : miguelgrinberg
async def create(stream, client_addr):
# request line
line = (await stream.readline()).strip().decode()
method, url, http_version = line.split()
http_version = http_version.split('/', 1)[1]
# headers
headers = {}
content_length = 0
while True:
line = (await stream.readline()).strip().decode()
if line == '':
break
header, value = line.split(':', 1)
value = value.strip()
headers[header] = value
if header == 'Content-Length':
content_length = int(value)
# body
body = await stream.read(content_length) \
if content_length else b''
return Request(client_addr, method, url, http_version, headers, body)