Search code examples
pythonpython-requestsipv6

Python requests on IPv6 only server does not seem to work


I have an IPv6 only Debian server, with python2.7 and requests installed. I follow the tutorial and do:

import requests
r = requests.get('https://api.github.com/events')

and I get:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/requests/api.py", line 60, in get
    return request('get', url, **kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/api.py", line 49, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 457, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 569, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 407, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', error(110, 'Connection timed out'))

How do I make this work on an IPv6 server? It seems to work fine on my home machine (debian+py2.7+requests)


Solution

  • You complain bitterly to GitHub regarding their still not having deployed IPv6, despite many people asking them for this for several years.

    Some people have put up public IPv6 proxies to GitHub, though for your safety and mine I won't recommend any particular one. It's also possible to do this yourself.

    Ultimately, GitHub needs to join the rest of us in the 21st century. It should not be necessary for the community to provide a service that GitHub themselves are expected to be providing!