Failed to establish a new connection: [Errno -2] Name or service not known

Viewed 8321

i'm running this script on python:

import requests
url = "http://finance.yahoo.com/quote/AAPL?p=AAPL"
response = requests.get(url)
print(response)

and i'm getting the following error:

Traceback (most recent call last):
  File "python", line 6, in <module>
requests.exceptions.ConnectionError: HTTPConnectionPool(host='finance.yahoo.com', port=80): Max retries exceeded with url: /quote/AAPL?p=AAPL (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7fcbf36d3a20>: Failed to establish a new connection: [Errno -2] Name or service not known',))

what could be the reason?

thanks

1 Answers
Related