google-ads-python icon indicating copy to clipboard operation
google-ads-python copied to clipboard

SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)')))

Open sithara opened this issue 2 years ago • 1 comments

Hi While trying to execute I keep getting the below error

google.auth.exceptions.TransportError: HTTPSConnectionPool(host='accounts.google.com', port=443): Max retries exceeded with url: /o/oauth2/token (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: 
unable to get local issuer certificate (_ssl.c:1131)')))

Please see the trace below

Traceback (most recent call last):
  File "get_campaigns.py", line 52, in <module>
    googleads_client = GoogleAdsClient.load_from_storage(version="v11")
  File "C:\Users\Sithara.Suresh\AppData\Local\Programs\Python\Python38\lib\site-packages\google\ads\googleads\client.py", line 
290, in load_from_storage
    kwargs = cls._get_client_kwargs(config_data)
  File "C:\Users\Sithara.Suresh\AppData\Local\Programs\Python\Python38\lib\site-packages\google\ads\googleads\client.py", line 
182, in _get_client_kwargs
    "credentials": oauth2.get_credentials(config_data),
  File "C:\Users\Sithara.Suresh\AppData\Local\Programs\Python\Python38\lib\site-packages\google\ads\googleads\oauth2.py", line 
114, in get_credentials
    return get_installed_app_credentials(
  File "C:\Users\Sithara.Suresh\AppData\Local\Programs\Python\Python38\lib\site-packages\google\ads\googleads\oauth2.py", line 
48, in initialize_credentials_wrapper
    credentials.refresh(Request())
  File "C:\Users\Sithara.Suresh\AppData\Local\Programs\Python\Python38\lib\site-packages\google\oauth2\credentials.py", line 302, in refresh
    ) = reauth.refresh_grant(
  File "C:\Users\Sithara.Suresh\AppData\Local\Programs\Python\Python38\lib\site-packages\google\oauth2\reauth.py", line 322, in refresh_grant
    response_status_ok, response_data = _client._token_endpoint_request_no_throw(
  File "C:\Users\Sithara.Suresh\AppData\Local\Programs\Python\Python38\lib\site-packages\google\oauth2\_client.py", line 124, in _token_endpoint_request_no_throw
    response = request(
  File "C:\Users\Sithara.Suresh\AppData\Local\Programs\Python\Python38\lib\site-packages\google\auth\transport\requests.py", line 199, in __call__
    six.raise_from(new_exc, caught_exc)
  File "<string>", 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(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: 
unable to get local issuer certificate (_ssl.c:1131)')))

I'm using python 3.8 and invoking script get_campagin.py. Appreciate your help

sithara avatar Sep 14 '22 18:09 sithara

@sithara thanks for the information. How are you configuring the authentication of the library? Are you following this prerequisites section, then adding the tokens into a local yaml file following these instructions?

BenRKarl avatar Sep 26 '22 14:09 BenRKarl

@sithara closing this for now assuming you were able to fix this issue on your own.

BenRKarl avatar Dec 06 '22 14:12 BenRKarl