YuriCosta / WhatsApp-GD-Extractor-Multithread

Allows WhatsApp users on Android to extract their backed up WhatsApp data from Google Drive.
GNU General Public License v3.0
182 stars 54 forks source link

SSL: CERTIFICATE_VERIFY_FAILED #54

Open miladinovicb opened 2 weeks ago

miladinovicb commented 2 weeks ago

Hello, I get: branislav@Branislavs-MacBook-Pro-3 WhatsApp-GD-Extractor-Multithread % python3 WhatsAppGDExtract.py info Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/urllib3/connectionpool.py", line 716, in urlopen httplib_response = self._make_request( ^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/urllib3/connectionpool.py", line 404, in _make_request self._validate_conn(conn) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/urllib3/connectionpool.py", line 1061, in _validate_conn conn.connect() File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/urllib3/connection.py", line 419, in connect self.sock = ssl_wrapsocket( ^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/urllib3/util/ssl.py", line 458, in ssl_wrap_socket ssl_sock = _ssl_wrap_socketimpl( ^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/urllib3/util/ssl.py", line 502, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 455, in wrap_socket return self.sslsocket_class._create( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 1042, in _create self.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 1320, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/requests/adapters.py", line 667, in send resp = conn.urlopen( ^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/urllib3/connectionpool.py", line 802, in urlopen retries = retries.increment( ^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/urllib3/util/retry.py", line 594, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='android.clients.google.com', port=443): Max retries exceeded with url: /auth (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/branislav/WhatsApp-GD-Extractor-Multithread/WhatsAppGDExtract.py", line 260, in main(sys.argv) File "/Users/branislav/WhatsApp-GD-Extractor-Multithread/WhatsAppGDExtract.py", line 209, in main wa_backup = WaBackup(getConfigs()) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/branislav/WhatsApp-GD-Extractor-Multithread/WhatsAppGDExtract.py", line 63, in init token = gpsoauth.perform_master_login(gmail, password, android_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/gpsoauth/init.py", line 154, in perform_master_login return _perform_auth_request(data, proxy) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/gpsoauth/init.py", line 97, in _perform_auth_request res = session.post(AUTH_URL, data=data, verify=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/requests/sessions.py", line 637, in post return self.request("POST", url, data=data, json=json, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/requests/sessions.py", line 589, in request resp = self.send(prep, send_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/requests/sessions.py", line 703, in send r = adapter.send(request, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/requests/adapters.py", line 698, in send raise SSLError(e, request=request) requests.exceptions.SSLError: HTTPSConnectionPool(host='android.clients.google.com', port=443): Max retries exceeded with url: /auth (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)')))

macagua commented 1 week ago

I fixed with the following commands:

pip3 install --upgrade certifi
python3 -c "import certifi; print(certifi.where())"

export REQUESTS_CA_BUNDLE=/PATH/TO/THE/certifi/LIB/cacert.pem
echo 'export REQUESTS_CA_BUNDLE=/PATH/TO/THE/certifi/LIB/cacert.pem' >> ~/.bashrc
source ~/.bashrc
sudo apt-get install --reinstall ca-certificates
sudo cp /PATH/TO/THE/certifi/LIB/cacert.pem /etc/ssl/certs/
sudo update-ca-certificates
python3 WhatsAppGDExtract.py info