/ / Warum erhalte ich CERTIFICATE_VERIFY_FAILED von Google AdWords API? - python-2.7, google-api, google-adwords, google-api-client, google-api-python-client

Warum erhalte ich CERTIFICATE_VERIFY_FAILED von Google Adwords API? - Python-2.7, Google-API, Google-Adwords, Google-API-Client, Google-API-Python-Client

Warum Google AdWords API aufhört, rufen Sie diesen Link auf:

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

Bei diesem Fehler - sollte ich vorher ein Zertifikat laden und wie?

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

Verwenden von Python 2.7.10.

Vollständiger Quellcode: create_adwords_client_without_yaml.py

Vollständiger Fehlercode:

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:rootPython27libsite-packagesgoogleadsadwords.py", line 256, in GetService
proxy=proxy_option, cache=self.cache, timeout=3600)
File "C:rootPython27libsite-packagessudsclient.py", line 115, in __init__
self.wsdl = reader.open(url)
File "C:rootPython27libsite-packagessudsreader.py", line 150, in open
d = self.fn(url, self.options)
File "C:rootPython27libsite-packagessudswsdl.py", line 136, in __init__
d = reader.open(url)
File "C:rootPython27libsite-packagessudsreader.py", line 74, in open
d = self.download(url)
File "C:rootPython27libsite-packagessudsreader.py", line 92, in download
fp = self.options.transport.open(Request(url))
File "C:rootPython27libsite-packagessudstransporthttps.py", line 62, in open
return HttpTransport.open(self, request)
File "C:rootPython27libsite-packagessudstransporthttp.py", line 67, in open
return self.u2open(u2request)
File "C:rootPython27libsite-packagessudstransporthttp.py", line 132, in u2open
return url.open(u2request, timeout=tm)
File "C:rootPython27liburllib2.py", line 431, in open
response = self._open(req, data)
File "C:rootPython27liburllib2.py", line 449, in _open
"_open", req)
File "C:rootPython27liburllib2.py", line 409, in _call_chain
result = func(*args)
File "C:rootPython27liburllib2.py", line 1240, in https_open
context=self._context)
File "C:rootPython27liburllib2.py", line 1197, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)>

Antworten:

3 für die Antwort № 1

Python verwendet Zertifikate von "system sslZertifikatspeicher ", um die https-Verbindung zu zertifizieren, wenn im Speicher kein geeignetes SSL-Zertifikat vorhanden ist. Laden Sie das SSL-Zertifikat herunter (Öffnen Sie Ihren https-Link im Browser und klicken Sie auf das Schlosssymbol in der Adressleiste> Weitere Informationen> Zertifikat anzeigen> Details> Exportieren) und installieren Sie es auf Ihrem System, wie unter diesem Link angegeben http://windows.microsoft.com/en-us/windows/import-export-certificates-private-keys#1TC=windows-7


2 für die Antwort № 2

Ich bin mir nicht sicher, ob das das Problem ist, aber es lohnt sich, es zu überprüfen.

Python 2.7.9 aktiviert Zertifikatsprüfung standardmäßig für HTTP Verbindungen.

Der Server, zu dem Sie eine Verbindung herstellen, verfügt nicht über ein Zertifikat, dem Ihr Client vertraut. Pysphere sollte dies konfigurieren SSL passend für diesen Anwendungsfall.

Versuchen Sie, Ihre Anfrage wie folgt zu stellen:

requests.get("https://adwords.google.com/api/adwords/mcm/v201502/CustomerService?wsdl", verify=False)

0 für die Antwort № 3

Versuchen Sie dies, es hat mir geholfen:

import ssl

ssl._create_default_https_context = ssl._create_unverified_context