ddbeck / starnearyou

A bot tweeting animated GIFs of the Sun's corona.
http://twitter.com/starnearyou
MIT License
3 stars 2 forks source link

Back off on retrying URLs #2

Open ddbeck opened 7 years ago

ddbeck commented 7 years ago
Traceback (most recent call last):
  File "/home/botally/starnearyou/venv-python3.5.2/lib/python3.5/site-packages/requests/packages/urllib3/connection.py", line 142, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "/home/botally/starnearyou/venv-python3.5.2/lib/python3.5/site-packages/requests/packages/urllib3/util/connection.py", line 98, in create_connection
    raise err
  File "/home/botally/starnearyou/venv-python3.5.2/lib/python3.5/site-packages/requests/packages/urllib3/util/connection.py", line 88, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/botally/starnearyou/venv-python3.5.2/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 595, in urlopen
    chunked=chunked)
  File "/home/botally/starnearyou/venv-python3.5.2/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 363, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/home/botally/.pyenv/versions/3.5.2/lib/python3.5/http/client.py", line 1106, in request
    self._send_request(method, url, body, headers)
  File "/home/botally/.pyenv/versions/3.5.2/lib/python3.5/http/client.py", line 1151, in _send_request
    self.endheaders(body)
  File "/home/botally/.pyenv/versions/3.5.2/lib/python3.5/http/client.py", line 1102, in endheaders
    self._send_output(message_body)
  File "/home/botally/.pyenv/versions/3.5.2/lib/python3.5/http/client.py", line 934, in _send_output
    self.send(msg)
  File "/home/botally/.pyenv/versions/3.5.2/lib/python3.5/http/client.py", line 877, in send
    self.connect()
  File "/home/botally/starnearyou/venv-python3.5.2/lib/python3.5/site-packages/requests/packages/urllib3/connection.py", line 167, in connect
    conn = self._new_conn()
  File "/home/botally/starnearyou/venv-python3.5.2/lib/python3.5/site-packages/requests/packages/urllib3/connection.py", line 151, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
requests.packages.urllib3.exceptions.NewConnectionError: <requests.packages.urllib3.connection.HTTPConnection object at 0xb595d430>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/botally/starnearyou/venv-python3.5.2/lib/python3.5/site-packages/requests/adapters.py", line 417, in send
    timeout=timeout
  File "/home/botally/starnearyou/venv-python3.5.2/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 640, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/home/botally/starnearyou/venv-python3.5.2/lib/python3.5/site-packages/requests/packages/urllib3/util/retry.py", line 287, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
requests.packages.urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='sdo.gsfc.nasa.gov', port=80): Max retries exceeded with url: /assets/img/browse/2017/04/06/ (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0xb595d430>: Failed to establish a new connection: [Errno 111] Connection refused',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/botally/starnearyou/venv-python3.5.2/bin/starnearyou", line 11, in <module>
    sys.exit(cli())
  File "/home/botally/starnearyou/venv-python3.5.2/lib/python3.5/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/home/botally/starnearyou/venv-python3.5.2/lib/python3.5/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/home/botally/starnearyou/venv-python3.5.2/lib/python3.5/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/botally/starnearyou/venv-python3.5.2/lib/python3.5/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/botally/starnearyou/venv-python3.5.2/lib/python3.5/site-packages/starnearyou.py", line 127, in cli
    with open(make_sun_gif(work_dir), 'rb') as fp:
  File "/home/botally/starnearyou/venv-python3.5.2/lib/python3.5/site-packages/starnearyou.py", line 201, in make_sun_gif
    urls = list(frame_urls())
  File "/home/botally/starnearyou/venv-python3.5.2/lib/python3.5/site-packages/starnearyou.py", line 247, in frame_urls
    response = requests.get(sdo_url, stream=True, timeout=5 * 60)
  File "/home/botally/starnearyou/venv-python3.5.2/lib/python3.5/site-packages/requests/api.py", line 70, in get
    return request('get', url, params=params, **kwargs)
  File "/home/botally/starnearyou/venv-python3.5.2/lib/python3.5/site-packages/requests/api.py", line 56, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/botally/starnearyou/venv-python3.5.2/lib/python3.5/site-packages/requests/sessions.py", line 471, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/botally/starnearyou/venv-python3.5.2/lib/python3.5/site-packages/requests/sessions.py", line 581, in send
    r = adapter.send(request, **kwargs)
  File "/home/botally/starnearyou/venv-python3.5.2/lib/python3.5/site-packages/requests/adapters.py", line 481, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='sdo.gsfc.nasa.gov', port=80): Max retries exceeded with url: /assets/img/browse/2017/04/06/ (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0xb595d430>: Failed to establish a new connection: [Errno 111] Connection refused',))