simplenote-vim / simplenote.py

Python API wrapper for the Simplenote web service

Home Page:http://readthedocs.org/docs/simplenotepy/en/latest/api.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Need better error handling when internet connection is down.

vivekhub opened this issue · comments

When we run the tests on a VM with no network access, we get a strange TypeError. Seems to be inside urllib project.

Traceback (most recent call last):
File "tests/test_simplenote.py", line 19, in setUp
self.clear_all_notes()
File "tests/test_simplenote.py", line 209, in clear_all_notes
res, status = self.simplenote_instance.get_note_list()
File "/Users/vivekv/.venv/simplenote/lib/python3.7/site-packages/simplenote/simplenote.py", line 273, in get_note_list
response = urllib2.urlopen(request)
File "/usr/local/Cellar/python/3.7.6/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/usr/local/Cellar/python/3.7.6/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 525, in open
response = self._open(req, data)
File "/usr/local/Cellar/python/3.7.6/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 543, in _open
'_open', req)
File "/usr/local/Cellar/python/3.7.6/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 503, in _call_chain
result = func(*args)
File "/usr/local/Cellar/python/3.7.6/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1362, in https_open
context=self._context, check_hostname=self._check_hostname)
File "/usr/local/Cellar/python/3.7.6/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1319, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/usr/local/Cellar/python/3.7.6/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1252, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/local/Cellar/python/3.7.6/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1293, in _send_request
self.putheader(hdr, value)
File "/usr/local/Cellar/python/3.7.6/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1229, in putheader
if _is_illegal_header_value(values[i]):
TypeError: expected string or bytes-like object

Looks very closely related to: #27

For the same reasons given there this is not something I can work on myself (if I don't have a network connection I don't tend to have access to my main development machine 😉 )

However, I welcome contributions - perhaps in addition to or based off of that PR. It needs to be well proven enough that I can merge without testing myself.