shaare.it

requests.exceptions.SSLError: wrong version number

7 Dec 2025

1 min read

SSLError: wrong version number

$ python -c "import requests; requests.get('https://legacy.tls.server')"
Traceback (most recent call last):
  ...
requests.exceptions.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number

Why this happens

Client/server TLS versions/ciphers are incompatible.

Fix

Upgrade server TLS, use proper port (avoid HTTPS on HTTP port), or ensure modern ciphers.

Wrong code

import requests
requests.get('https://example.com:80')  # HTTPS on HTTP port

Fixed code

import requests
requests.get('http://example.com:80')