Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why I receive CERTIFICATE_VERIFY_FAILED from google adwords api?

Why google adwords api stops on call this link:

https://adwords.google.com/api/adwords/mcm/v201502/CustomerService?wsdl

With this error - should I load some certificate before and how?

urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)>

Using Python 2.7.10.

Full source code: create_adwords_client_without_yaml.py

Full error code:

Traceback (most recent call last):
  File "C:/Users/Crezary Wagner/PycharmProjects/learn-adwords/src/examples/create_adwords_client_without_yaml.py", line 56, in <module>
    CLIENT_CUSTOMER_ID)
  File "C:/Users/Crezary Wagner/PycharmProjects/learn-adwords/src/examples/create_adwords_client_without_yaml.py", line 50, in main
    customer = adwords_client.GetService('CustomerService').get()
  File "C:\root\Python27\lib\site-packages\googleads\adwords.py", line 256, in GetService
    proxy=proxy_option, cache=self.cache, timeout=3600)
  File "C:\root\Python27\lib\site-packages\suds\client.py", line 115, in __init__
    self.wsdl = reader.open(url)
  File "C:\root\Python27\lib\site-packages\suds\reader.py", line 150, in open
    d = self.fn(url, self.options)
  File "C:\root\Python27\lib\site-packages\suds\wsdl.py", line 136, in __init__
    d = reader.open(url)
  File "C:\root\Python27\lib\site-packages\suds\reader.py", line 74, in open
    d = self.download(url)
  File "C:\root\Python27\lib\site-packages\suds\reader.py", line 92, in download
    fp = self.options.transport.open(Request(url))
  File "C:\root\Python27\lib\site-packages\suds\transport\https.py", line 62, in open
    return HttpTransport.open(self, request)
  File "C:\root\Python27\lib\site-packages\suds\transport\http.py", line 67, in open
    return self.u2open(u2request)
  File "C:\root\Python27\lib\site-packages\suds\transport\http.py", line 132, in u2open
    return url.open(u2request, timeout=tm)
  File "C:\root\Python27\lib\urllib2.py", line 431, in open
    response = self._open(req, data)
  File "C:\root\Python27\lib\urllib2.py", line 449, in _open
    '_open', req)
  File "C:\root\Python27\lib\urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "C:\root\Python27\lib\urllib2.py", line 1240, in https_open
    context=self._context)
  File "C:\root\Python27\lib\urllib2.py", line 1197, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)>
like image 414
Chameleon Avatar asked Jun 08 '15 08:06

Chameleon


People also ask

What is Certificate_verify_failed?

SSL certificate_verify_failed errors typically occur as a result of outdated Python default certificates or invalid root certificates. We will cover how to fix this issue in 4 ways in this article.

What is Adwords API?

An advanced feature that lets advertisers interact with and make changes to their Google Ads account through applications they create. The Google Ads API lets developers create and use applications that interact directly with their account details on the Google Ads server.

How do I install a certificate in Python?

To install certifi Python on Microsoft Windows: Type cmd in the search bar and hit Enter to open the command line. Type python3 -m pip install certifi in the command line and hit Enter again. This installs certifi for your default Python installation.


1 Answers

Python uses certificates from 'system ssl certificate store' to certify https connection, if there is not any appropriate ssl cert in the store error occurs like this. Download ssl certificate (Open your https link in browser and click lock icon in address bar > More Information > View Certificate > Details > Export) and install it on your system as stated this link http://windows.microsoft.com/en-us/windows/import-export-certificates-private-keys#1TC=windows-7

like image 86
Mansoor Ul Haq Avatar answered Sep 21 '22 23:09

Mansoor Ul Haq