Closed yuuki0xff closed 4 years ago
Caused by a bug in the simplenote library.
>>> import simplenote
>>> sn = simplenote.Simplenote('foo', 'bar')
>>> sn.get_token() is None
True
>>> import urllib.request
>>> req = urllib.request.Request('https://github.com')
>>> req.add_header('foo', None)
>>> urllib.request.urlopen(req)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.7/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.7/urllib/request.py", line 525, in open
response = self._open(req, data)
File "/usr/lib/python3.7/urllib/request.py", line 543, in _open
'_open', req)
File "/usr/lib/python3.7/urllib/request.py", line 503, in _call_chain
result = func(*args)
File "/usr/lib/python3.7/urllib/request.py", line 1360, in https_open
context=self._context, check_hostname=self._check_hostname)
File "/usr/lib/python3.7/urllib/request.py", line 1317, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/usr/lib/python3.7/http/client.py", line 1244, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.7/http/client.py", line 1285, in _send_request
self.putheader(hdr, value)
File "/usr/lib/python3.7/http/client.py", line 1221, in putheader
if _is_illegal_header_value(values[i]):
TypeError: expected string or bytes-like object
Added workaround code in a20dc63.