For reproducing the error.
First,
This reproduction step was done on ubuntu both on my local machine using wsl and on a remote server (aws instance).
Used the latest akinator.py
.
The expected result would not show that SSL Error and normally it would return an Akinator Object or String i.e the question.
Traceback (most recent call last):
File "/home/mito/Akinator-Bot/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 467, in _make_request
self._validate_conn(conn)
File "/home/mito/Akinator-Bot/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 1092, in _validate_conn
conn.connect()
File "/home/mito/Akinator-Bot/venv/lib/python3.10/site-packages/urllib3/connection.py", line 635, in connect
sock_and_verified = _ssl_wrap_socket_and_match_hostname(
File "/home/mito/Akinator-Bot/venv/lib/python3.10/site-packages/urllib3/connection.py", line 774, in _ssl_wrap_socket_and_match_hostname
ssl_sock = ssl_wrap_socket(
File "/home/mito/Akinator-Bot/venv/lib/python3.10/site-packages/urllib3/util/ssl_.py", line 459, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)
File "/home/mito/Akinator-Bot/venv/lib/python3.10/site-packages/urllib3/util/ssl_.py", line 503, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
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.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/mito/Akinator-Bot/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 790, in urlopen
response = self._make_request(
File "/home/mito/Akinator-Bot/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 491, in _make_request
raise new_e
urllib3.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/mito/Akinator-Bot/venv/lib/python3.10/site-packages/requests/adapters.py", line 486, in send
resp = conn.urlopen(
File "/home/mito/Akinator-Bot/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 844, in urlopen
retries = retries.increment(
File "/home/mito/Akinator-Bot/venv/lib/python3.10/site-packages/urllib3/util/retry.py", line 515, in increment
raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='en.akinator.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/mito/Akinator-Bot/temp.py", line 5, in <module>
a.start_game()
File "/home/mito/Akinator-Bot/venv/lib/python3.10/site-packages/akinator/akinator.py", line 160, in start_game
region_info = self._auto_get_region(get_lang_and_theme(language)["lang"], get_lang_and_theme(language)["theme"])
File "/home/mito/Akinator-Bot/venv/lib/python3.10/site-packages/akinator/akinator.py", line 112, in _auto_get_region
r = requests.get("https://" + uri)
File "/home/mito/Akinator-Bot/venv/lib/python3.10/site-packages/requests/api.py", line 73, in get
return request("get", url, params=params, **kwargs)
File "/home/mito/Akinator-Bot/venv/lib/python3.10/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "/home/mito/Akinator-Bot/venv/lib/python3.10/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "/home/mito/Akinator-Bot/venv/lib/python3.10/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "/home/mito/Akinator-Bot/venv/lib/python3.10/site-packages/requests/adapters.py", line 517, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='en.akinator.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')))```
### System Information
wsl2
-----------------------------
OS : `Ubuntu 22.04.2 LTS`
Python: `Python 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0] on linux`
akinator version: `akinator 1.0.3`
AWS Instance
-----------------------------
OS : `Ubuntu 22.04.2 LTS`
Python: `Python 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0] on linux`
akinator version: `akinator 1.0.3`
### Checklist
- [X] I have searched open issues for duplicates.
- [X] I have shown the entire traceback, if possible.
- [X] I have made sure that this issue is valid.
### Additional Context
I was able to solve these errors by including `verify=False` in `requests.get()` for all requests in `akinator.py`.
Suppose if we have something like,
```python
r = requests.get("https://en.akinator.com/game")