我似乎無法連接Adwords API。我遵循的步驟如下所述:https://developers.google.com/adwords/api/docs/first-requestPython Adwords API身份驗證問題
文件所在的文件夾C:\用戶\用戶\文檔\ googleads的Python-lib的主\ 和認證文件(googleads.yaml)填充了我的帳戶設置。這些帳戶設置以前在Java環境中工作。
任何關於發生了什麼問題的建議?
我使用Python 3.5.1和Python的最新Adwords API。
我收到的錯誤代碼是:
C:/Users/User/Documents/googleads-python-lib-master/examples/adwords/v201509/basic_operations/get_campaigns.py
INFO:oauth2client.client:Refreshing access_token
DEBUG:suds.transport.http:opening (https://adwords.google.com/api/adwords/cm/v201509/CampaignService?wsdl)
DEBUG:suds.transport.http:sending:
URL: https://adwords.google.com/api/adwords/cm/v201509/CampaignService
HEADERS: {'Content-Type': 'text/xml; charset=utf-8', 'Content-type': 'text/xml; charset=utf-8', 'Soapaction': b'""', 'SOAPAction': b'""', 'Authorization': 'Bearer ya29.ngJKUmqHAKGfa93lSHVcYtpj6IHzN9KAoaMhGS_LEZJvrJjHnEl8Kx83leap3ae-g_zHmzA'}
MESSAGE:
b'<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="https://adwords.google.com/api/adwords/cm/v201509" xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201509" xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Header><tns:RequestHeader><tns:developerToken>xxxxxxxxxxxxx</tns:developerToken><tns:userAgent>Client name (AwApi-Python, googleads/3.11.0, Python/3.5.1)</tns:userAgent><tns:validateOnly>false</tns:validateOnly><tns:partialFailure>false</tns:partialFailure></tns:RequestHeader></SOAP-ENV:Header><ns0:Body><ns1:get><ns1:serviceSelector><ns1:fields>Id</ns1:fields><ns1:fields>Name</ns1:fields><ns1:fields>Status</ns1:fields><ns1:paging><ns1:startIndex>0</ns1:startIndex><ns1:numberResults>100</ns1:numberResults></ns1:paging></ns1:serviceSelector></ns1:get></ns0:Body></SOAP-ENV:Envelope>'
ERROR:suds.client:<suds.sax.document.Document object at 0x03F01390>
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python35-32\lib\site-packages\suds_jurko-0.6-py3.5.egg\suds\transport\http.py", line 82, in send
File "C:\Users\User\AppData\Local\Programs\Python\Python35-32\lib\site-packages\suds_jurko-0.6-py3.5.egg\suds\transport\http.py", line 132, in u2open
File "C:\Users\User\AppData\Local\Programs\Python\Python35-32\lib\urllib\request.py", line 471, in open
response = meth(req, response)
File "C:\Users\User\AppData\Local\Programs\Python\Python35-32\lib\urllib\request.py", line 581, in http_response
'http', request, response, code, msg, hdrs)
File "C:\Users\User\AppData\Local\Programs\Python\Python35-32\lib\urllib\request.py", line 509, in error
return self._call_chain(*args)
File "C:\Users\User\AppData\Local\Programs\Python\Python35-32\lib\urllib\request.py", line 443, in _call_chain
result = func(*args)
File "C:\Users\User\AppData\Local\Programs\Python\Python35-32\lib\urllib\request.py", line 589, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 500: Internal Server Error
https://github.com/googleads/googleads-python-lib/issues/10 – fabrigm
感謝您的評論。所以,如果我理解正確,那麼在Python 3.x中使用OAuth2進行身份驗證是不可能的? – Dendrobates
看來,是的... – fabrigm