googleads / googleads-python-lib

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

Python SSL error 'certificate verify failed' #336

Closed davideguatta closed 7 months ago

davideguatta commented 6 years ago

Hello all, I want to use AdWords Python APIs for reporting purposes. I set up tokens (also refresh token) following https://github.com/googleads/googleads-python-lib#user-content-getting-started

Problem comes when I try to download a report, where I'm getting: TransportError: HTTPSConnectionPool(host='accounts.google.com', port=443): Max retries exceeded with url: /o/oauth2/token (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')])")))

Please notice that the same script works on another laptop of the same company connected over the same network. I would appreciate to receive a list of checks to be performed against the other working machine to isolate the problem, if possible Thanks a lot!!

Follows the Python code that generates the error

client = adwords.AdWordsClient.LoadFromStorage(path=os.getcwd()+'\credentials\googleads.yml') report_downloader = client.GetReportDownloader(version='v201809')

Create report definition.

report = { 'reportName': 'Last 30 days CRITERIA_PERFORMANCE_REPORT', 'dateRangeType': 'LAST_30_DAYS', 'reportType': 'CRITERIA_PERFORMANCE_REPORT', 'downloadFormat': 'CSV', 'selector': { 'fields': ['CampaignId', 'AdGroupId', 'Id', 'CriteriaType', 'Criteria', 'FinalUrls', 'Impressions', 'Clicks', 'Cost'] } }

Print out the report as a string

print(report_downloader.DownloadReportAsString( report, skip_report_header=False, skip_column_header=False, skip_report_summary=False, include_zero_impressions=True))

christopherseeley commented 7 months ago

Closing as obsolete since this is from 2018 and the AdWords API has been turned down. If anyone is experiencing similar issues, checking proxy environment variables and corporate firewall policies is a good place to start.