minor fixes for micropython

This commit is contained in:
Miguel Grinberg
2019-04-16 12:14:22 +01:00
parent 311a82a444
commit e4ff70cf8f
2 changed files with 9 additions and 5 deletions

View File

@@ -1,5 +1,11 @@
import json
import re
try:
import ujson as json
except ImportError:
import json
try:
import ure as re
except ImportError:
import re
try:
import usocket as socket
except ImportError:
@@ -49,7 +55,6 @@ class Request():
if line == '':
break
header, value = line.split(':', 1)
header = header.title()
value = value.strip()
self.headers[header] = value
if header == 'Content-Length':
@@ -146,7 +151,6 @@ class Response():
content_length_found = False
content_type_found = False
for header, value in self.headers.items():
header = header.title()
values = value if isinstance(value, list) else [value]
for value in values:
client_stream.write('{header}: {value}\r\n'.format(

View File

@@ -15,7 +15,7 @@ setup(
author_email='miguel.grinberg@gmail.com',
description='Impossibly small web framework for MicroPython',
long_description=__doc__,
packages=['microdot'],
py_modules=['microdot'],
zip_safe=False,
include_package_data=True,
platforms='any',