Unable to use the script due to the following errors
erbanku opened this issue · comments
Error Messages
[11/03/2023 20:36:06]root@gcp-server-hk-2:~/learn-thu$ python learn.py
Traceback (most recent call last):
File "/usr/lib/python3.10/urllib/request.py", line 1348, in do_open
h.request(req.get_method(), req.selector, req.data, headers,
File "/usr/lib/python3.10/http/client.py", line 1283, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.10/http/client.py", line 1329, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.10/http/client.py", line 1278, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.10/http/client.py", line 1038, in _send_output
self.send(msg)
File "/usr/lib/python3.10/http/client.py", line 976, in send
self.connect()
File "/usr/lib/python3.10/http/client.py", line 1455, in connect
self.sock = self._context.wrap_socket(self.sock,
File "/usr/lib/python3.10/ssl.py", line 513, in wrap_socket
return self.sslsocket_class._create(
File "/usr/lib/python3.10/ssl.py", line 1071, in _create
self.do_handshake()
File "/usr/lib/python3.10/ssl.py", line 1342, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: UNSAFE_LEGACY_RENEGOTIATION_DISABLED] unsafe legacy renegotiation disabled (_ssl.c:1007)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/root/learn-thu/learn.py", line 60, in open_page
response = opener.open(request)
File "/usr/lib/python3.10/urllib/request.py", line 519, in open
response = self._open(req, data)
File "/usr/lib/python3.10/urllib/request.py", line 536, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
File "/usr/lib/python3.10/urllib/request.py", line 496, in _call_chain
result = func(*args)
File "/usr/lib/python3.10/urllib/request.py", line 1391, in https_open
return self.do_open(http.client.HTTPSConnection, req,
File "/usr/lib/python3.10/urllib/request.py", line 1351, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: UNSAFE_LEGACY_RENEGOTIATION_DISABLED] unsafe legacy renegotiation disabled (_ssl.c:1007)>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/root/learn-thu/learn.py", line 478, in <module>
main(get_args())
File "/root/learn-thu/learn.py", line 462, in main
args.login = login(username, password)
File "/root/learn-thu/learn.py", line 94, in login
info = get_page(login_uri, values)
File "/root/learn-thu/learn.py", line 67, in get_page
data = open_page(uri, values)
File "/root/learn-thu/learn.py", line 63, in open_page
print(uri, e.code, ':', e.reason)
AttributeError: 'URLError' object has no attribute 'code'
Lines 32 to 40 in 5646e6e
It was fixed by downgrading the Python version.
I am too busy with my schoolwork now, so I have no time to rewrite the code, but I can consider rewriting it after completing my schoolwork.