Reputation: 383
I do not use requests library often so I do not know how to debug this error. I am using some code from github. https://github.com/ashleycoxley/twitter-analytics-export
The error is with the .get function.
tw_url = "https://twitter.com/"
session = requests.session()
first_req = session.get(tw_url)
Error Message:
requests.exceptions.SSLError: ("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",)
It's probably simple, but any help would be appreciated.
Thanks,
Upvotes: 1
Views: 267
Reputation: 24251
You can
add verify = False
to:
first_req = session.get(tw_url, verify = False)
Explanation
For some reason your Python code doesn't trust the SSL certificate presented by twitter.com
. FWIW, it might not be Twitter at all, who your code is talking to.
Most likely this is due to your computer's configuration of trusted Certificate Authorities and/or something in between you and Twitter (e.g. your ISP) interfering with your communication.
And verify=False
simply means "I don't care if the server I connect to, is not a real Twitter.com just let me connect to it".
Upvotes: 1