raynoldng / pyfluminus

LumiNUS API written in Python with auto file downloading
MIT License
6 stars 3 forks source link

ERROR: unable to get local issuer certificate (_ssl.c:1123) #5

Open over-fitted opened 3 years ago

over-fitted commented 3 years ago

using Ubuntu 20.03 with NUS_STU wifi, latest python 3.8.5, did pip3 with requirements.txt

tried to python3 pyfluminus_cli.py -username="e123456" -password="password" (obviously not real credentials)

got the following error: Traceback (most recent call last): File "/home/naws/.local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 665, in urlopen httplib_response = self._make_request( File "/home/naws/.local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 376, in _make_request self._validate_conn(conn) File "/home/naws/.local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 994, in _validate_conn conn.connect() File "/home/naws/.local/lib/python3.8/site-packages/urllib3/connection.py", line 386, in connect self.sock = ssl_wrapsocket( File "/home/naws/.local/lib/python3.8/site-packages/urllib3/util/ssl.py", line 370, in ssl_wrap_socket return context.wrap_socket(sock, server_hostname=server_hostname) File "/usr/lib/python3.8/ssl.py", line 500, in wrap_socket return self.sslsocket_class._create( File "/usr/lib/python3.8/ssl.py", line 1040, in _create self.do_handshake() File "/usr/lib/python3.8/ssl.py", line 1309, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/requests/adapters.py", line 439, in send resp = conn.urlopen( File "/home/naws/.local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 719, in urlopen retries = retries.increment( File "/home/naws/.local/lib/python3.8/site-packages/urllib3/util/retry.py", line 436, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='luminus.nus.edu.sg', port=443): Max retries exceeded with url: /auth/callback?code=itFF1arP8UGo8DZsRZZDGg.IavbUaiz2AjgZhCQENfk4bNurmI.CSB1siK9zkWoL9RGFndyd_CyMp-UIvyYSlS-WIH_dLsCV_ynMNINlRHQ2uv-IYOpA5D1JDxth7IO47546yNvnPNEqCM_ZzudsuTY5ptO4kfmI2uy1OEyuzgyhkrlEPzRTnjv0eYlc-bkxJE79fTZqWX0q8bL6FR0igYKs1qjlmDlB29FyKvCcc9KbEMZ7ca7S3ekRf9ZedN7-flaX-tbQfGrRPVuPNrBwU8-p7dWusLdAtKqLEOVQPU5gVcQRWNRdeyHvHgFPOvsFxdy8PzjI24FVn6JeSCdwJAQEdlw6ekvqwCM-ewVt6MzkcgQfjTMQ8vrWayIXNxXlheA9m_yZg (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "pyfluminus_cli.py", line 47, in auth = vafs_jwt("nusstu\" + username, password) File "/home/naws/pyfluminus/pyfluminus/authorization.py", line 33, in vafs_jwt response = requests.post(url, headers=auth_headers, data=auth_data) File "/usr/lib/python3/dist-packages/requests/api.py", line 116, in post return request('post', url, data=data, json=json, kwargs) File "/usr/lib/python3/dist-packages/requests/api.py", line 60, in request return session.request(method=method, url=url, kwargs) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in request resp = self.send(prep, send_kwargs) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 668, in send history = [resp for resp in gen] if allow_redirects else [] File "/usr/lib/python3/dist-packages/requests/sessions.py", line 668, in history = [resp for resp in gen] if allow_redirects else [] File "/usr/lib/python3/dist-packages/requests/sessions.py", line 239, in resolve_redirects resp = self.send( File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in send r = adapter.send(request, kwargs) File "/usr/lib/python3/dist-packages/requests/adapters.py", line 514, in send raise SSLError(e, request=request) requests.exceptions.SSLError: HTTPSConnectionPool(host='luminus.nus.edu.sg', port=443): Max retries exceeded with url: /auth/callback?code=itFF1arP8UGo8DZsRZZDGg.IavbUaiz2AjgZhCQENfk4bNurmI.CSB1siK9zkWoL9RGFndyd_CyMp-UIvyYSlS-WIH_dLsCV_ynMNINlRHQ2uv-IYOpA5D1JDxth7IO47546yNvnPNEqCM_ZzudsuTY5ptO4kfmI2uy1OEyuzgyhkrlEPzRTnjv0eYlc-bkxJE79fTZqWX0q8bL6FR0igYKs1qjlmDlB29FyKvCcc9KbEMZ7ca7S3ekRf9ZedN7-flaX-tbQfGrRPVuPNrBwU8-p7dWusLdAtKqLEOVQPU5gVcQRWNRdeyHvHgFPOvsFxdy8PzjI24FVn6JeSCdwJAQEdlw6ekvqwCM-ewVt6MzkcgQfjTMQ8vrWayIXNxXlheA9m_yZg (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)')))

over-fitted commented 3 years ago

tried using private hotspot same issue

aaditkamat commented 3 years ago

@raynoldng @indocomsoft, I'm wondering if this has anything to do with using https://luminus.portal.azure-api.net/login/ADFSToken in place of https://vafs.nus.edu.sg/adfs/oauth2/authorize for OAuth as suggested in the LumiNUS docs

indocomsoft commented 3 years ago

Same reason as https://github.com/fluminurs/fluminurs/issues/621