Python SSL error 'certificate verify failed'

640 views
Skip to first unread message

Davide Guatta

unread,
Oct 16, 2018, 7:40:47 PM10/16/18
to AdWords API and Google Ads API Forum
Hello all,
I want to use AdWords Python APIs for reporting purposes.

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))

Dannison Yao (AdWords API Team)

unread,
Oct 17, 2018, 1:48:24 AM10/17/18
to AdWords API and Google Ads API Forum
Hi Davide, 

The error you're encountering doesn't seem to be AdWords API specific as you were able to successfully run a report in another machine. You could try to report an issue to the googleads-python-lib issue tracker as the client library owners are better equipped to help on this concern.

Sincerely,
Dane
AdWords API Team
Reply all
Reply to author
Forward
0 new messages