example-code
example-code copied to clipboard
ValueError: charset must not be in content_type argument
When running http server given by example-code/18-asyncio/charfinder/http_charfinder.py the error is thrown:
Error handling request Traceback (most recent call last): File "/home/osboxes/.local/lib/python3.5/site-packages/aiohttp/web_protocol.py", line 416, in start resp = yield from self._request_handler(request) File "/home/osboxes/.local/lib/python3.5/site-packages/aiohttp/web.py", line 323, in _handle resp = yield from handler(request) File "/home/osboxes/.local/lib/python3.5/site-packages/aiohttp/web_urldispatcher.py", line 139, in handler_wrapper result = old_handler(*args, **kwargs) File "http_charfinder.py", line 43, in home return web.Response(content_type=CONTENT_TYPE, text=html) File "/home/osboxes/.local/lib/python3.5/site-packages/aiohttp/web_response.py", line 458, in __init__ raise ValueError("charset must not be in content_type " ValueError: charset must not be in content_type argument
My Env: Python 3.5, aiohttp 2.3.2
Removing charset=UTF-8
param from CONTENT_TYPE
constant solves the issue.