mrCarnivore
mrCarnivore

Reputation: 5078

requests.exceptions.ConnectionError [Errno 11004] getaddrinfo failed using Requests in Python. Browser works

I tried my using the requests library of python. Sadly I fail at even the most basic steps. I looked at the quickstart guide here: http://docs.python-requests.org/en/latest/user/quickstart/

Following code fails:

import requests

r = requests.get('http://www.google.com')

with:

requests.exceptions.ConnectionError: HTTPConnectionPool(host='www.google.com', port=80): 
Max retries exceeded with url: / (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x0000000003CC3BA8>: 
Failed to establish a new connection: [Errno 11004] getaddrinfo failed',))

That reads like there was a problem with my network, however opening the same web page in the browser works so it can't be the reason that it's blocking me, can it?

P.S. copy/pasting the example from the quickstart page and trying to opening 'https://api.github.com/events' also fails with the same error.

Upvotes: 0

Views: 1680

Answers (1)

mrCarnivore
mrCarnivore

Reputation: 5078

I have found out that in my company they somehow do not provide a DNS server for script requests. That is the reason it did not work.

Upvotes: 1

Related Questions