-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nvpy v2.0.0 doesn't work offline #191
Labels
Comments
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. |
yuuki0xff
added a commit
to yuuki0xff/simplenote.py
that referenced
this issue
Oct 3, 2019
Simplenote.authenticate() and get_token() usually return a str. When offline, these methods return None. The get_note(), update_note(), etc. do not consider for this behavior. Therefore, None will be set to http header, and TypeError will occur when sending a request. Related: cpbotha/nvpy#191 BROKEN CHANGE: authenticate() and get_token() no longer catch the IOError, BadStatusLine and part of HTTPError errors.
yuuki0xff
added a commit
to yuuki0xff/simplenote.py
that referenced
this issue
Oct 18, 2019
Simplenote.authenticate() and get_token() usually return a str. When offline, these methods return None. The get_note(), update_note(), etc. do not consider for this behavior. Therefore, None will be set to http header, and TypeError will occur when sending a request. Related: cpbotha/nvpy#191
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: