我试图运行get_campaigns.py示例代码。我使用正确的client_id
,client_secret
和refresh_token
创建了adwords客户端对象。当我运行它时,我得到以
Server raised fault: '[QuotaCheckError.INVALID_TOKEN_HEADER @ ; trigger:'6Ji***developer-token****Yg']'
当我向上滚动日志时,我看到HEADERS已被记录,并且根据this guide
他们根本没有提到developerToken
本来应该有的URL: https://adwords.google.com/api/adwords/cm/v201605/CampaignService
HEADERS: {'Soapaction': b'""', 'Content-Type': 'text/xml; charset=utf-8', 'Content-type': 'text/xml; charset=utf-8', 'Authorization': 'Bearer ya2***access_token***194f3g', 'SOAPAction': b'""'}
MESSAGE:
b'<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:tns="https://adwords.google.com/api/adwords/cm/v201605" xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201605" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header><tns:RequestHeader><tns:clientCustomerId>659-360-1388</tns:clientCustomerId><tns:developerToken>6Ji***developer-token****Yg</tns:developerToken><tns:userAgent>MYM (AwApi-Python, googleads/4.2.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>'
client_id
另外,请您确认一下:使用报告+创建client_secret
和{{1}}时,开发人员令牌已授予 info@mydomain.com testaccount@mydomain.com 这是我为测试API而创建的测试经理帐户。这是否也会产生问题?此外,developer_token现在处于 test_account 状态。
答案 0 :(得分:0)
这是因为将开发人员令牌复制到我的代码时出错。您可以在Google网上论坛上阅读讨论 - https://groups.google.com/forum/#!topic/adwords-api/V4oaXBgEm8k