PlaceStart/placestart

Read time out error handling

Closed this issue · 1 comments

I've encountered a Read timed out twice now, might need some error handling.

During handling of the above exception, another exception occurred:                                                                                                                                                                                           Traceback (most recent call last):                                                                                               File "monitor.py", line 204, in <module>                                                                                         fire.Fire(PlacestartMonitor)                                                                                                 File "/usr/local/lib/python3.4/dist-packages/fire/core.py", line 116, in Fire                                                    component_trace = _Fire(component, args, context, name)                                                                      File "/usr/local/lib/python3.4/dist-packages/fire/core.py", line 330, in _Fire                                                   component, remaining_args)                                                                                                   File "/usr/local/lib/python3.4/dist-packages/fire/core.py", line 536, in _CallCallable                                           result = fn(*varargs, **kwargs)                                                                                              File "monitor.py", line 199, in maintenance                                                                                      self.fix_something()                                                                                                         File "monitor.py", line 151, in fix_something                                                                                    timeout=5                                                                                                                    File "/usr/lib/python3/dist-packages/requests/sessions.py", line 467, in get                                                     return self.request('GET', url, **kwargs)                                                                                    File "/usr/lib/python3/dist-packages/requests/sessions.py", line 455, in request                                                 resp = self.send(prep, **send_kwargs)                                                                                        File "/usr/lib/python3/dist-packages/requests/sessions.py", line 578, in send                                                    history = [resp for resp in gen] if allow_redirects else []                                                                  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 578, in <listcomp>                                              history = [resp for resp in gen] if allow_redirects else []                                                                  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 178, in resolve_redirects                                       allow_redirects=False,                                                                                                       File "/usr/lib/python3/dist-packages/requests/sessions.py", line 558, in send                                                    r = adapter.send(request, **kwargs)                                                                                          File "/usr/lib/python3/dist-packages/requests/adapters.py", line 387, in send                                                    raise Timeout(e)                                                                                                           requests.exceptions.Timeout: HTTPSConnectionPool(host='www.reddit.com', port=443): Read timed out. (read timeout=5)   

I've surrounded the whole thing with a try-catch, reddit sometimes gives bad answers randomly. Thanks!