Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

執行時出現SSL相關的錯誤訊息 #1

Closed
NeiL978 opened this issue Jan 11, 2021 · 2 comments
Closed

執行時出現SSL相關的錯誤訊息 #1

NeiL978 opened this issue Jan 11, 2021 · 2 comments

Comments

@NeiL978
Copy link

NeiL978 commented Jan 11, 2021

請問在執行的時候出現以下的錯誤訊息,看起來像SSL認證問題? 請問怎麼解決呢? 謝謝

Traceback (most recent call last):
File "C:\Users\godbl\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 696, in urlopen
self._prepare_proxy(conn)
File "C:\Users\godbl\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 964, in _prepare_proxy
conn.connect()
File "C:\Users\godbl\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connection.py", line 359, in connect
conn = self._connect_tls_proxy(hostname, conn)
File "C:\Users\godbl\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connection.py", line 496, in connect_tls_proxy
return ssl_wrap_socket(
File "C:\Users\godbl\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\ssl
.py", line 432, in ssl_wrap_socket
ssl_sock = ssl_wrap_socket_impl(sock, context, tls_in_tls)
File "C:\Users\godbl\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\ssl
.py", line 474, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock)
File "C:\Users\godbl\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "C:\Users\godbl\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1040, in _create
self.do_handshake()
File "C:\Users\godbl\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
ssl.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\godbl\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\adapters.py", line 439, in send
resp = conn.urlopen(
File "C:\Users\godbl\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "C:\Users\godbl\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\retry.py", line 573, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='hk4e-api-os.mihoyo.com', port=443): Max retries exceeded with url: /event/gacha_info/api/getGachaLog?authkey_ver=1&sign_type=2&auth_appid=webview_gacha&init_type=301&gacha_id=8b5ca18f79ee64a0cd71826c24a0c0808ac813&lang=zh-tw&device_type=pc&ext=%7B%22loc%22%3A%7B%22x%22%3A-663.3135375976563%2C%22y%22%3A220.3798370361328%2C%22z%22%3A262.802734375%7D%2C%22platform%22%3A%22WinST%22%7D&game_version=OSRELWin1.2.0_R1771533_S1780278_D1780278&region=os_asia&authkey=J7jN9eAf7qUpbn3QeTW5HEo4CeNBD%2BF9lhWS65VZQ5igp03zQsKZ7oTimbpVNfO3%2BxxUMC9%2F2Fq%2FJFZEkRGQxKTkgYp%2BKeaAA2SojMNbpgxWZYleKiwbuY%2BsqIfqJweXUV7Ep%2FiHOWM8a6YlA28xYu6p%2BYOD6ZabCqtakNC%2BCrx9luwTlVIuL5zpXdKSRMrtb859au7SlxJmqfhjD28OzFzndm2merTW5mPeHfh6RC25tvcCmXPm9ncAgmGeZz%2BGVN8aJ55ZTwkhz%2B23v%2BHfi7chL6I99ZTSxJQ6xVxNuUYq7KJ6gHDS4QG2Zt39nAxnJ%2BRmHq%2FoilQP8uaEYpCFLzVx5dwxES7u%2BWMQh7s7N04rYIfMvn4SKg6BTaAyivJuV8Q3FhSVKwcIHMWpKhxStabn8OLDcrA%3D%3D&game_biz=hk4e_global&gacha_type=200&page=1&size=20 (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)')))

@sunfkny
Copy link
Owner

sunfkny commented Jan 11, 2021

重新运行试一下
或者把 Line 5注释,Line 46 改成r = requests.get(api)试试,

requests.packages.urllib3.disable_warnings()
r = requests.get(api, verify=False)
这两行本来就是解决这个问题的

@NeiL978
Copy link
Author

NeiL978 commented Jan 11, 2021

改成你說的就可以用了
謝謝

@NeiL978 NeiL978 closed this as completed Jan 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants