I'm trying to get started with PRAW but I'm having issues using login().
I have the following piece of code:
import praw
r = praw.Reddit('This is a test bot')
r.login('myRedditUsername','password')
And I get the following error:
requests.exceptions.SSLError: [Errno 1] _ssl.c:503: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Is there a way around this outside of disabling SSL?
According to praw SSLError during login from shared hosting:
UPD: made the error go away by adding my company's internal certificate to the cacert.pem file.
Below the steps:
This is my old answer, I temporary fixed the problem by turning off SSL verification
I had the same issue on Windows 7, not only with login, but with any request to reddit.
r.config._ssl_url = None
didn't do the trick either, after creating praw.ini as C:\users\&user_name\AppData\Roaming\praw.ini:I finally made it work. Though I have the InsecureRequestWarning warning. Wanted to throw that here in case if someone like me is still struggling with that.
TL;DR:
_ssl_url
doesn't work in PRAW 4. Use a custom Requests session withSession.verify
.For PRAW 4 or later:
According to PRAW's developer, the option to use
config._ssl_url = None
was removed in PRAW 4. Instead, you can use a custom Requests Session to configure your own SSL settings.Assuming you are on a company network with self-signed certificates, you have two options.
Option 1 - Trusting a Self-Signed Certificate
First, export your company's root certificate as a
.pem
file. (See Export a PEM-Format Certificate From a Windows System)Next, create a Requests session and specify a path directly to your certificate file.
Option 2 - Disabling SSL Verification (insecure)
This method will fully disable HTTPS verification for all requests. While this method is simple, it is strongly discouraged for security reasons. (See SSL Warnings)
See Also