0

I am trying to use request.get in python, but it is throwing error. I am using this very simple code:

import requests

x = requests.get('https://w3schools.com')
print(x.status_code)

However, this throws this error:

ProxyError: HTTPSConnectionPool(host='w3schools.com', port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001ECB3E72040>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')))
python_pi
  • 95
  • 1
  • 9

1 Answers1

0

There's nothing wrong with your code (prints 200 for me), but you may want to try to disable SSL verification:

x = requests.get('https://w3schools.com', verify=False)

Python is known for not trusting anything out there.

JustLearning
  • 1,435
  • 1
  • 1
  • 9