I'm getting the following error in Python when trying to import requests library on Windows (the same code runs fine on Ubuntu).
Traceback (most recent call last):
File "c:/Users/thomp/Documents/Coding Projects/Crawler/crawl.py", line 4, in <module>
import requests
File "C:\Users\thomp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\__init__.py", line 103, in <module>
from urllib3.contrib import pyopenssl
File "C:\Users\thomp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\contrib\pyopenssl.py", line 84, in <module>
ssl.PROTOCOL_TLSv1: OpenSSL.SSL.TLSv1_METHOD,
AttributeError: module 'ssl' has no attribute 'PROTOCOL_TLSv1'
What I suspect is happening: I think that one of the packages is referencing TLS 1.0 but another package is throwing an error because that's a deprecated protocol that it doesn't support anymore.
I've tried:
- Updating the packages (requests, pyopenssl, urllib3)
- Uninstalling and reinstalling the packages
- Installing OpenSSL for Windows
But none of that has helped. Any suggestions?
pip freeze results:
astroid==2.4.2
beautifulsoup4==4.9.1
certifi==2020.6.20
cffi==1.14.1
chardet==3.0.4
colorama==0.4.3
cryptography==3.0
idna==2.10
isort==4.3.21
lazy-object-proxy==1.4.3
mccabe==0.6.1
pycparser==2.20
pylint==2.5.3
pyOpenSSL==19.1.0
requests==2.24.0
six==1.15.0
soupsieve==2.0.1
toml==0.10.1
urllib3==1.25.10
wrapt==1.12.1