googleads / googleads-python-lib

The Python client library for Google's Ads APIs
Apache License 2.0
683 stars 975 forks source link

HTTPSConnectionPool(host='accounts.google.com', port=443): Max retries exceeded with url: /o/oauth2/token (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)'))) #516

Open JhPlayGround opened 1 year ago

JhPlayGround commented 1 year ago

Traceback (most recent call last): File "C:\hermes_server\venv\lib\site-packages\urllib3\connectionpool.py", line 699, in urlopen httplib_response = self._make_request( File "C:\hermes_server\venv\lib\site-packages\urllib3\connectionpool.py", line 382, in _make_request self._validate_conn(conn) File "C:\hermes_server\venv\lib\site-packages\urllib3\connectionpool.py", line 1010, in _validate_conn conn.connect() File "C:\hermes_server\venv\lib\site-packages\urllib3\connection.py", line 411, in connect self.sock = ssl_wrap_socket( File "C:\hermesserver\venv\lib\site-packages\urllib3\util\ssl.py", line 428, in ssl_wrap_socket ssl_sock = _ssl_wrap_socket_impl( File "C:\hermesserver\venv\lib\site-packages\urllib3\util\ssl.py", line 472, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) File "C:\Users\Artience\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 500, in wrap_socket return self.sslsocket_class._create( File "C:\Users\Artience\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1040, in _create self.do_handshake() File "C:\Users\Artience\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1309, in do_handshake self._sslobj.do_handshake() ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1129)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\hermes_server\venv\lib\site-packages\requests\adapters.py", line 439, in send resp = conn.urlopen( File "C:\hermes_server\venv\lib\site-packages\urllib3\connectionpool.py", line 755, in urlopen retries = retries.increment( File "C:\hermes_server\venv\lib\site-packages\urllib3\util\retry.py", line 573, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='accounts.google.com', port=443): Max retries exceeded with url: /o/oauth2/token (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\hermes_server\venv\lib\site-packages\google\auth\transport\requests.py", line 183, in call response = self.session.request( File "C:\hermes_server\venv\lib\site-packages\requests\sessions.py", line 542, in request resp = self.send(prep, send_kwargs) File "C:\hermes_server\venv\lib\site-packages\requests\sessions.py", line 655, in send r = adapter.send(request, kwargs) File "C:\hermes_server\venv\lib\site-packages\requests\adapters.py", line 514, in send raise SSLError(e, request=request) requests.exceptions.SSLError: HTTPSConnectionPool(host='accounts.google.com', port=443): Max retries exceeded with url: /o/oauth2/token (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)')))

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\hermes_server\app\main\modules\api\google\ads_v2\connection.py", line 36, in get_client_by_token google_ads_client = GoogleAdsClient.load_from_dict(config_dict={"developer_token": developer_token, File "C:\hermes_server\venv\lib\site-packages\google\ads\googleads\client.py", line 268, in load_from_dict kwargs = cls._get_client_kwargs(config_data) File "C:\hermes_server\venv\lib\site-packages\google\ads\googleads\client.py", line 182, in _get_client_kwargs "credentials": oauth2.get_credentials(config_data), File "C:\hermes_server\venv\lib\site-packages\google\ads\googleads\oauth2.py", line 114, in get_credentials return get_installed_app_credentials( File "C:\hermes_server\venv\lib\site-packages\google\ads\googleads\oauth2.py", line 48, in initialize_credentials_wrapper credentials.refresh(Request()) File "C:\hermes_server\venv\lib\site-packages\google\oauth2\credentials.py", line 293, in refresh ) = reauth.refresh_grant( File "C:\hermes_server\venv\lib\site-packages\google\oauth2\reauth.py", line 318, in refresh_grant response_status_ok, response_data = _client._token_endpoint_request_no_throw( File "C:\hermes_server\venv\lib\site-packages\google\oauth2_client.py", line 115, in _token_endpoint_request_no_throw response = request(method="POST", url=token_uri, headers=headers, body=body) File "C:\hermes_server\venv\lib\site-packages\google\auth\transport\requests.py", line 189, in call six.raise_from(new_exc, caught_exc) File "", line 3, in raise_from google.auth.exceptions.TransportError: HTTPSConnectionPool(host='accounts.google.com', port=443): Max retries exceeded with url: /o/oauth2/token (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)')))

This is how errors keep happening. There was no problem before, but this problem occurred two days ago.

msaniscalchi commented 4 months ago

It seems to be raised in the google-auth library. At least based on a similar report in their issue tracker, a high volume of requests produced the error for their configured environment. It appears to have been resolved after updating their OS / SSL installation.