Fix 'Unable to get local issuer certificate' in Python requests

If you're encountering the error message "Unable to get local issuer certificate" while using Python requests library, there's a simple fix you can try.

This error usually occurs when the SSL certificate on the server you're trying to connect to is not trusted by your machine. To fix this issue, you need to add the root certificates to your system's trusted certificate store.

Here are the steps to fix the issue:

1. Download the root certificates from the server you're trying to connect to. You can usually find these certificates in the SSL certificate chain.

2. Save the certificates to a file with a .pem extension.

3. Install the certificates by copying the .pem file to the appropriate directory on your system. The location may vary depending on your operating system and Python installation.

4. Verify that the certificates were installed correctly by running the following command in your Python shell:

```python
import requests
requests.get('https://example.com')
```

If the SSL certificate is now trusted by your machine, the request should succeed without any errors.

In summary, to fix the "Unable to get local issuer certificate" error in Python requests, you need to add the root certificates to your system's trusted certificate store. This can be done by downloading the certificates, saving them to a .pem file, and installing them on your system.

Click to rate this post!
[Total: 0 Average: 0]

Related posts

Leave a Reply

Your email address will not be published. Required fields are marked *

Go up

Below we inform you of the use we make of the data we collect while browsing our pages. You can change your preferences at any time by accessing the link to the Privacy Area that you will find at the bottom of our main page. More Information