Python 2.7 Adwords API UserListService在调用mutate时导致属性错误
我正在使用Google AdWords API userListService添加一个新的用户列表,我已经通过了所有必需的输入,并且成功创建了adword客户端实例 但是在调用mutate方法时,它抛出了一个属性错误 “AttributeError:类HttpTransport没有属性'\u HttpTransport\u get\u request\u url'” 请找到StackTrace:Python 2.7 Adwords API UserListService在调用mutate时导致属性错误,python-2.7,api,google-ads-api,google-api-python-client,Python 2.7,Api,Google Ads Api,Google Api Python Client,我正在使用Google AdWords API userListService添加一个新的用户列表,我已经通过了所有必需的输入,并且成功创建了adword客户端实例 但是在调用mutate方法时,它抛出了一个属性错误 “AttributeError:类HttpTransport没有属性'\u HttpTransport\u get\u request\u url'” 请找到StackTrace: import uuid from googleads import adwords from goo
import uuid
from googleads import adwords
from googleads import oauth2
def main(client):
# Initialize appropriate service.
user_list_service = client.GetService(
'AdwordsUserListService', version='v201702')
# Construct operations and add a user list.
operations = [
{
'operator': 'ADD',
'operand': {
'xsi_type': 'BasicUserList',
'name': 'Mars cruise customers #%s' % uuid.uuid4(),
'description': 'A list of mars cruise customers in the last
year',
'membershipLifeSpan': '365',
'conversionTypes': [
{
'name': ('Mars cruise customers #%s'
% uuid.uuid4())
}
],
# Optional field.
'status': 'OPEN',
}
}
]
result = user_list_service.mutate(operations)
if __name__ == '__main__':
CLIENT_ID = 'xxx'
CLIENT_SECRET = 'xxx'
REFRESH_TOKEN = 'xxx'
DEVELOPER_TOKEN = 'xxx'
USER_AGENT = 'xxx'
CLIENT_CUSTOMER_ID = 'xxx'
oauth2_client = oauth2.GoogleRefreshTokenClient(CLIENT_ID, CLIENT_SECRET, REFRESH_TOKEN)
adwords_client = adwords.AdWordsClient(DEVELOPER_TOKEN, oauth2_client, USER_AGENT,client_customer_id=CLIENT_CUSTOMER_ID)
main(adwords_client)
回溯(最近一次呼叫最后一次):
文件“C:\Program Files(x86)\JetBrains\PyCharm Community Edition 5\helpers\pydev\pydevd.py”,第2411行,在
globals=debugger.run(setup['file'],None,None,is_模块)
文件“C:\Program Files(x86)\JetBrains\PyCharm Community Edition 5\helpers\pydev\pydevd.py”,第1802行,正在运行
启动(文件、全局、局部)#执行脚本
文件“D:/Python Studies/SVN Code/Work In Progress/Source Code/doubleclick Dmp Integration/DmpIntegrationApplication/dmpintegration/dmpex/adwords.py”,第93行,在
主(ADU客户端)
文件“D:/Python Studies/SVN Code/Work In Progress/Source Code/doubleclick Dmp Integration/DmpIntegrationApplication/dmpintegration/dmpex/adwords.py”,第33行,在main中
结果=用户\列表\服务.mutate(操作)
MakeSoapRequest中的文件“C:\Python27\lib\site packages\googleads\common.py”,第720行
*[[u PackForSuds(arg,self.suds\u client.factory)用于args中的arg])
文件“C:\Python27\lib\site packages\suds\client.py”,第542行,在调用中
返回client.invoke(args、kwargs)
文件“C:\Python27\lib\site packages\suds\client.py”,第602行,在invoke中
结果=self.send(soapenv)
文件“C:\Python27\lib\site packages\suds\client.py”,第637行,在send中
回复=传输。发送(请求)
文件“C:\Python27\lib\site packages\googleads\util.py”,第92行,在PatchedHttpTransportSend中
url=http\U传输。\ http传输\获取\请求\ url(请求)
AttributeError:类HttpTransport没有属性“\u HttpTransport\u获取\u请求\u url”
这是我的代码:
import uuid
from googleads import adwords
from googleads import oauth2
def main(client):
# Initialize appropriate service.
user_list_service = client.GetService(
'AdwordsUserListService', version='v201702')
# Construct operations and add a user list.
operations = [
{
'operator': 'ADD',
'operand': {
'xsi_type': 'BasicUserList',
'name': 'Mars cruise customers #%s' % uuid.uuid4(),
'description': 'A list of mars cruise customers in the last
year',
'membershipLifeSpan': '365',
'conversionTypes': [
{
'name': ('Mars cruise customers #%s'
% uuid.uuid4())
}
],
# Optional field.
'status': 'OPEN',
}
}
]
result = user_list_service.mutate(operations)
if __name__ == '__main__':
CLIENT_ID = 'xxx'
CLIENT_SECRET = 'xxx'
REFRESH_TOKEN = 'xxx'
DEVELOPER_TOKEN = 'xxx'
USER_AGENT = 'xxx'
CLIENT_CUSTOMER_ID = 'xxx'
oauth2_client = oauth2.GoogleRefreshTokenClient(CLIENT_ID, CLIENT_SECRET, REFRESH_TOKEN)
adwords_client = adwords.AdWordsClient(DEVELOPER_TOKEN, oauth2_client, USER_AGENT,client_customer_id=CLIENT_CUSTOMER_ID)
main(adwords_client)