4

Environment:
Corporate firewall

Problem:
When calling

w3 = Web3(Web3.HTTPProvider("https://ropsten.infura.io/v3/API_KEY"))

in web3.py, the request will be blocked by firewall with

SSLError("Can't connect to HTTPS URL because the SSL module is not available.")

Attempt:

Web3(Web3.HTTPProvider("https://ropsten.infura.io/v3/API_KEY", 
                       request_kwargs={'cert': "CERTIFICATE.pem"})) 

which should solve the issue according the python request documentation. However this problem persists.

Question:
Is there any mistake with my attempt? Is there a way to deactivate SSL cert?

TylerH
  • 20,799
  • 66
  • 75
  • 101
WQL
  • 41
  • 1

1 Answers1

1

The relevant message is:

Can't connect to HTTPS URL because the SSL module is not available.

Python on your computer doesn't have access to the SSL module (probably OpenSSL).

Others have run into this issue, usually on custom OS environments, which would be common on a corporate computer: https://github.com/requests/requests/issues/3482

Their advice is:

you need to contact whomever built your Python install. If it was you, then you need to check the Python documentation because you didn't link against OpenSSL.


Note that this is not an web3-specific problem, or an Ethereum-specific problem. I would also expect this to fail with the same error:

import requests
requests.get('https://www.google.com')

Is there a way to deactivate SSL cert?

Plain-text connections will allow anyone to see your traffic. It would be wise to get SSL working for a wide variety of security and privacy reasons.

carver
  • 2,229
  • 12
  • 28
  • But what to do if the given certificate is self-signed ? How to tell python to ignore it instead of getting a connection error ? – user2284570 Aug 12 '21 at 22:32