Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix 'requests.exceptions.SSLError'

I have read many articles about that but none worked for me. Also, I tried other solutions but still I'm stuck. I have a simple code:

import requests

requests.get('https://s1.wcy.wat.edu.pl/ed1/', verify=False)

After setting verification to False I'm still getting an error:

requests.exceptions.SSLError: HTTPSConnectionPool(host='s1.wcy.wat.edu.pl', port=443): Max retries exceeded with url: /ed1/ (Caused by SSLError(SSLError(1, '[SSL: UNSUPPORTED_PROTOCOL] unsupported protocol (_ssl.c:1056)')))

EDIT: Problem solved. For those who has the same problem. Make sure what is your website TLS verion. In my case it was 1.0. Then you must go to /etc/ssl and edit openssl.cnf. At the bottom you have

[system_default_sect]
MinProtocol = TLSv1.2
CipherString = DEFAULT@SECLEVEL=2

Just change 1.2 to 1.0. Worked for me

like image 483
Shirakumo Avatar asked Apr 14 '19 21:04

Shirakumo


People also ask

How do I skip SSL verification in Python?

Method 1: Passing verify=False to request methodAlong with the URL also pass the verify=False parameter to the method in order to disable the security checks.

What is a request exception?

An exception request petition is a request to make registration changes retroactively or to request exceptions to academic rules related to university-wide requirements. Exception request petitions are for registration errors or extenuating circumstances that prevented students from meeting registration deadlines.

What requests exceptions ConnectionError?

Error Exception ConnectionError − This will be raised, if there is any connection error. For example, the network failed, DNS error so the Request library will raise ConnectionError exception. Response. raise_for_status() − Based on status code i.e. 401, 404 it will raise HTTPError for the url requested.


1 Answers

I had the same issue. By changing verify=False to verify=ssl.CERT_NONE, I fixed it.

like image 69
xilpex Avatar answered Sep 19 '22 05:09

xilpex