SSL: WRONG_VERSION_NUMBER during python requests.get

Viewed 4275

I am trying to access a pypi url like this:

PYPI_URL = https://pypi.org/pypi/Django/json

try:
    response = requests.get(PYPI_URL)

except requests.exceptions.RequestException as err:
    print("Unable to access Pypi. ", err)

But when I am trying to generate vcr cassettes for a pytest, I get this error.

E       AssertionError: assert 'Unable to access Pypi' not in "Unable to acce...l.c:1108)')))\n"
E         'Unable to access Pypi' is contained here:
E           Unable to access Pypi. Error Connecting:  HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /pypi/Django/json (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1108)')))
E         ? +++++++++++++++++++++

What am I doing wrong? Why does it complain only when I try to generate cassette? The test passes if I just run pytest without generating VCR cassette.

0 Answers
Related