Jan
Jan

Reputation: 33

Python 3.6 Requests SSLerror "unexpected eof while reading'

the following code works perfectly fine under Python 2.7:

import requests
url = "https://ec.europa.eu/clima/ets/"
r = requests.get(url)
r.status_code

However under Python 3.6 or 3.7 the code breaks with the error message:

SSLError: ("read error: Error([('SSL routines', 'ssl3_read_n', 'unexpected eof while reading')],)",)

Would be very thankful for every suggestion how to run it under Python 3.

P.S. requests version is 2.22 under all python versions

Update

It seems that the error was caused by openssl version 1.1.1e. Upgrading to 1.1.1f solved the problem for me.

Upvotes: 2

Views: 10335

Answers (1)

Alexey Muravyov
Alexey Muravyov

Reputation: 1153

This can be related to openssl 1.1.1e bug

You it is your server check version that you have

yum info ea-openssl11

If you have 1.1.1e, then you can downgrade to 1.1.1d

yum downgrade ea-openssl11

and restart php-fpm if you have it

Upvotes: 1

Related Questions