mozilla/agithub

Error requesting to custom endpoint

aballano opened this issue · 2 comments

Hi there!

FIrst of all thanks for the lib, it looks really good and usable.

I'm trying to connect to an enterprise endpoint, like:

gh = GitHub(token=token, api_url=base_url + '/api/v3/')

But after that, any request (eg. gh.issues.get()) I try fails with this exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/agithub/base.py", line 157, in get
    return self.request('GET', url, None, headers)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/agithub/base.py", line 207, in request
    conn.request(method, url, requestBody.process(), headers)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1057, in request
    self._send_request(method, url, body, headers)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1097, in _send_request
    self.endheaders(body)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1053, in endheaders
    self._send_output(message_body)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 897, in _send_output
    self.send(msg)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 859, in send
    self.connect()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1270, in connect
    HTTPConnection.connect(self)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 836, in connect
    self.timeout, self.source_address)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 557, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

I tried to run this locally to see if it was a dns/connection trouble:

socket.gethostbyname(base_url)

But it returns me the right IP address.

Any ideas? Thanks in advance!

nnja commented

Hi @aballano.

I've used this library successfully with Enterprise GitHub before. Unfortunately, I don't have access to that instance anymore, so I can't test your specific scenario.

I recommend checking the following configuration settings:

  1. That the API URL is correct for your Enterprise GitHub instance.
  2. That the network you're on is able to access the Enterprise GitHub API. For example, in my case, while I could navigate the Enterprise GitHub instance off VPN, I couldn't send requests to the API unless my computer was connected to VPN.

Since this isn't an issue with the library I'm closing the issue.

Sorry that I have bad news but I have the same issue with the same error message and the same setup (having GitHub Enterprise 3.5).