Coding⏱️ 3 min read📅 2026-06-15

How to Fix: Error with SSL certificate when using Python shell

Error with SSL certificate when using Python shell

Quick Answer: To fix the error, you need to install the correct SSL certificate. You can do this by running `pip install pyopenssl` or `pip install cryptography` and then try again.

Error with SSL certificate when using Python's requests.get to get info from any site occurs due to an issue with the SSL certificate verification process. This error affects all users who are trying to access websites that use HTTPS protocol.

This error can be frustrating as it prevents users from accessing certain websites or receiving important information. However, a solution is available and will be explained in detail below.

💡 Why You Are Getting This Error

  • The primary reason for this error is the inability of Python's requests library to verify the SSL certificate of the website. This can occur due to several reasons such as an outdated or corrupted SSL certificate, incorrect configuration of the SSL settings, or issues with the local issuer certificate.
  • An alternative cause could be the presence of a self-signed or invalid SSL certificate on the website. In this case, Python's requests library may not be able to verify the certificate and will throw an error.

✅ Best Solutions to Fix It

Updating Python's requests library to use a more recent version

  1. Step 1: Open a terminal or command prompt and type pip install --upgrade requests to update the library.
  2. Step 2: If you are using a virtual environment, make sure to activate it before running the command.
  3. Step 3: After updating the library, try running your Python script again to see if the error persists.

Configuring SSL settings manually

  1. Step 1: Open the Python requests library source code and add the following line of code before making a request: `self.verify = False` or `self.verify = '/path/to/local/cert'`. This will disable the certificate verification process.
  2. Step 2: Alternatively, you can use the `ssl_context` parameter when making a request to specify the path to the local issuer certificate. For example: `requests.get(url, verify='/path/to/local/cert')`.

🎯 Final Words

To resolve the error with SSL certificate when using Python's requests.get, either update the library to use a more recent version or configure the SSL settings manually by disabling certificate verification or specifying the path to the local issuer certificate. If you are still experiencing issues, try contacting your system administrator for assistance.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions