- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个 python 脚本,可以从basketball-reference.com 获取一些信息
由于此错误,它今天停止工作:
File "C:\Users\pphotsauce\anaconda3\lib\site-packages\urllib3\connectionpool.py", line 670, in urlopen
httplib_response = self._make_request(
File "C:\Users\pphotsauce\anaconda3\lib\site-packages\urllib3\connectionpool.py", line 381, in _make_request
self._validate_conn(conn)
File "C:\Users\pphotsauce\anaconda3\lib\site-packages\urllib3\connectionpool.py", line 978, in _validate_conn
conn.connect()
File "C:\Users\pphotsauce\anaconda3\lib\site-packages\urllib3\connection.py", line 362, in connect
self.sock = ssl_wrap_socket(
File "C:\Users\pphotsauce\anaconda3\lib\site-packages\urllib3\util\ssl_.py", line 386, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "C:\Users\pphotsauce\anaconda3\lib\ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "C:\Users\pphotsauce\anaconda3\lib\ssl.py", line 1040, in _create
self.do_handshake()
File "C:\Users\pphotsauce\anaconda3\lib\ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\pphotsauce\anaconda3\lib\site-packages\requests\adapters.py", line 439, in send
File "C:\Users\pphotsauce\anaconda3\lib\site-packages\urllib3\connectionpool.py", line 726, in urlopen
retries = retries.increment(
File "C:\Users\pphotsauce\anaconda3\lib\site-packages\urllib3\util\retry.py", line 446, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
MaxRetryError: HTTPSConnectionPool(host='www.basketball-reference.com', port=443): Max retries exceeded with url: /search/search.fcgi?search=RJ+Barrett (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "G:\fan_duel\april_version\main_2.py", line 13, in <module>
test = [f.get_bref_id_tester(x) for x in full_names]
File "G:\fan_duel\april_version\main_2.py", line 13, in <listcomp>
test = [f.get_bref_id_tester(x) for x in full_names]
File "G:\fan_duel\april_version\functions.py", line 30, in get_bref_id_tester
search_results_page = requests.get(url, headers=headers, allow_redirects='False')
File "C:\Users\pphotsauce\anaconda3\lib\site-packages\requests\api.py", line 76, in get
File "C:\Users\pphotsauce\anaconda3\lib\site-packages\requests\api.py", line 61, in request
File "C:\Users\pphotsauce\anaconda3\lib\site-packages\requests\sessions.py", line 542, in request
File "C:\Users\pphotsauce\anaconda3\lib\site-packages\requests\sessions.py", line 655, in send
File "C:\Users\pphotsauce\anaconda3\lib\site-packages\requests\adapters.py", line 514, in send
SSLError: HTTPSConnectionPool(host='www.basketball-reference.com', port=443): Max retries exceeded with url: /search/search.fcgi?search=RJ+Barrett (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)')))
runfile('G:/fan_duel/april_version/main_2.py', wdir='G:/fan_duel/april_version')
Reloaded modules: functions
Traceback (most recent call last):
File "C:\Users\pphotsauce\anaconda3\lib\site-packages\urllib3\connectionpool.py", line 670, in urlopen
httplib_response = self._make_request(
File "C:\Users\pphotsauce\anaconda3\lib\site-packages\urllib3\connectionpool.py", line 381, in _make_request
self._validate_conn(conn)
File "C:\Users\pphotsauce\anaconda3\lib\site-packages\urllib3\connectionpool.py", line 978, in _validate_conn
conn.connect()
File "C:\Users\pphotsauce\anaconda3\lib\site-packages\urllib3\connection.py", line 362, in connect
self.sock = ssl_wrap_socket(
File "C:\Users\pphotsauce\anaconda3\lib\site-packages\urllib3\util\ssl_.py", line 386, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "C:\Users\pphotsauce\anaconda3\lib\ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "C:\Users\pphotsauce\anaconda3\lib\ssl.py", line 1040, in _create
self.do_handshake()
File "C:\Users\pphotsauce\anaconda3\lib\ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\pphotsauce\anaconda3\lib\site-packages\requests\adapters.py", line 439, in send
File "C:\Users\pphotsauce\anaconda3\lib\site-packages\urllib3\connectionpool.py", line 726, in urlopen
retries = retries.increment(
File "C:\Users\pphotsauce\anaconda3\lib\site-packages\urllib3\util\retry.py", line 446, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
MaxRetryError: HTTPSConnectionPool(host='www.basketball-reference.com', port=443): Max retries exceeded with url: /search/search.fcgi?search=Chris+Boucher (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "G:\fan_duel\april_version\main_2.py", line 13, in <module>
test = [f.get_bref_id_tester(x) for x in full_names]
File "G:\fan_duel\april_version\main_2.py", line 13, in <listcomp>
test = [f.get_bref_id_tester(x) for x in full_names]
File "G:\fan_duel\april_version\functions.py", line 33, in get_bref_id_tester
search_results_page = requests.get(url, headers=headers, allow_redirects='False')
File "C:\Users\pphotsauce\anaconda3\lib\site-packages\requests\api.py", line 76, in get
File "C:\Users\pphotsauce\anaconda3\lib\site-packages\requests\api.py", line 61, in request
File "C:\Users\pphotsauce\anaconda3\lib\site-packages\requests\sessions.py", line 542, in request
File "C:\Users\pphotsauce\anaconda3\lib\site-packages\requests\sessions.py", line 655, in send
File "C:\Users\pphotsauce\anaconda3\lib\site-packages\requests\adapters.py", line 514, in send
SSLError: HTTPSConnectionPool(host='www.basketball-reference.com', port=443): Max retries exceeded with url: /search/search.fcgi?search=Chris+Boucher (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)')))
我有一个使用 NBA 球员全名并返回篮球引用 ID 的函数。如果我将此函数应用于 Pandas 系列或遍历名称列表,则只有一些名称(每次不同的名称)会导致错误。 ('nightmare' 是一本名字很麻烦的字典)
nightmare = {
'Bol Bol': 'bolbo01',
'Nicolo Melli': 'mellini01',
'Davis Bertans': 'bertada01',
'Tomas Satoransky': 'satorto01',
'Theo Maledon': 'maledth01',
'Bogdan Bogdanovic': 'bogdabo01',
}
def get_bref_id(full_name):
sleep(0.2)
if full_name not in nightmare:
try:
first_name, last_name = full_name.split(' ')
url = 'https://www.basketball-reference.com/search/search.fcgi?search='+first_name+'+'+last_name
search_results_page = requests.get(url, allow_redirects = "False")
soup = bs(search_results_page.content, 'html.parser')
potential_links = soup.find_all('div', class_="search-item-name")
bucket = [element for element in potential_links if '202' in element.text if first_name in element.text]
bref_id = str(bucket[0]).replace('.', '/').split('/')[3]
except IndexError: # b-ref search occasionally takes you straight to the page
bref_id = search_results_page.url.split('/')[5].split('.')[0]
finally:
return bref_id
else:
return nightmare[full_name]
我对 SSL 或可能导致此问题的任何内容一无所知。如果您能指出正确的方向以了解更多信息,我将不胜感激。
最佳答案
服务器www.basketball-reference.com
至少需要 TLS 1.2。看起来您的 Python 与 OpenSSL 版本相关联,该版本太旧而无法支持 TLS 1.2。使用以下代码检查使用的是哪个 OpenSSL 版本。对 TLS 1.2 的支持是在很久以前的 OpenSSL 1.0.1 中添加的,但是例如 MacOS 很长一段时间都与旧版本的 OpenSSL 0.9.8 一起发布。
import ssl
print(ssl.OPENSSL_VERSION)
关于python请求: (SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)')),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66873398/
我想从源代码升级默认的python2.6.6到python2.7,我安装了: yum groupinstall "Development tools" yum install zlib-devel b
_ssl.sslwrap 函数似乎检查传入的 sock 是否是 _socket.socket 的子类。我正在传递一个实现 _socket.socket 接口(interface)的类。 它很生气,因为
带有 Python 2.7 的 Ubuntu Maverick: 我不知道如何解决以下导入错误: >>> import ssl Traceback (most recent call last):
问题 当我运行你的 python3 应用程序时,它显示 File "/usr/local/lib/python3.6/ssl.py", line 101, in import _ssl
Ubuntu Maverick w/Python 2.7: 我不知道如何解决以下导入错误: >>> import ssl Traceback (most recent call last): Fi
你知道这个错误吗: urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600) 当我运行
环境:Ubuntu 10.04.4 长期支持版Python 3.4.3 我有一个可以在 Windows 上完美运行的 python 3.4 Flask HTTPS 服务器。我需要将它转移到现有的 Ub
Python3 exchangelib 连接错误:_ssl.c:749? 我正在尝试使用 exchangelib 连接到我公司的 Exchange 服务器。我想查看我在 MS Exchange/OWA
当我执行以下行时, req = urllib2.Request(requestwithtoken) self.response = urllib2.urlopen(req,self.request).
我正在尝试这样的简单查询(在 geopy documentation 中出现: from geopy.geocoders import Nominatim geolocator = Nominatim
尝试运行Discord机器人时,出现以下错误: raise ClientConnectorCertificateError( aiohttp.client_exceptions.ClientC
我正在尝试使用 SSL 在 Redhat 中构建 python 2.7。我已经取消注释 Modules/Setup.dist 中的行: SSL=/urs/local/ssl _ssl _ssl.c -
有什么区别 import ssl 和 import _ssl 我在不同的服务器上运行 python 代码。在某些服务器上,两者都适合我。在其他服务器上,只有第二个有效,第一个给了我以下内容: Impo
对于 python request.get 和 request.post 调用,我得到了 [SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败 (_ssl.c:646)。以前
我正在尝试在我的 Mac 上安装 nltk,但在按照以下说明操作后我不断收到此错误消息: 安装 NLTK:sudo pip install -U nltk 安装 Numpy(可选):sudo pip
如下配置和安装python2.7: ./configure --enable-shared --with-ssl make install 然后使用命令 python setup.py install
尝试使用 gcc (Debian 6.2.1-7) 6.2.1 20161215 编译 Python 3.4.3 时出现以下错误: Failed to build these modules: _ha
我通过将源代码安装到我的 RHEL4 盒子中来添加 python 2.7.13 作为 altinstall wget --no-check-certificate https://www.python
我一直在尝试使用以下方法安装 python 包: pip install 我得到的是: “警告:在连接被 'SSLError(SSLCertVerificationError(1,'[SSL: CE
我想通过 python 脚本发送邮件并使用批处理文件启动脚本。从批处理文件启动时,我收到错误“ImportError: DLL load failed while importing _ssl”,当直
我是一名优秀的程序员,十分优秀!