'SSLError: max retries exceeded with url error? How to fix this?

I am attempting to scrape text off of websites, and I am using the requests module to do so.

With the given code (Facebook as an example here)

requests.get('http://facebook.com')

I receive back the following error:

SSLError: HTTPSConnectionPool(host='facebook.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])")))

I have tried the following with no luck:

pip install certifi
pip install certifi_win32

Any help would be greatly appreciated! Thank you!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source