requests ConnectionError 🐍 Python

requests.exceptions.ConnectionError: HTTPSConnectionPool(host=…, port=443): Max retries exceeded with url

requests couldn’t connect — the inner error (NewConnectionError, NameResolutionError, SSLError, ConnectTimeout) says why.

Seen on: Python

Meaning

“Max retries exceeded” is a wrapper. Read the “Caused by” part: name resolution means DNS, Connection refused means nothing listening, SSLError means certificates, timeouts mean network/firewall.

Common causes

  • DNS failure / typo in host
  • Server down or port blocked
  • Proxy settings
  • SSL certificate problems
  • Being rate-limited/blocked

⚡ Quick fix

  1. Read the “Caused by …” part of the message
  2. Test with curl from the same machine
  3. Set timeouts and use a Retry adapter

Detailed fix by platform

Python

  1. requests.get(url, timeout=(3, 30))

How to diagnose

  1. Cause — What follows "Caused by"?
  2. Reachability — curl from the same host

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.