Hi,
I am currently working on creating Remarketing lists. I am using the Google
AdWords API's Python libraries.
I needed to create a LogicalUserList combining two ExpressionRuleUserList.
This is the error I got:
suds.WebFault: Server raised fault: 'Cannot construct an instance of
com.google.ads.api.services.datax.userlists.LogicalUserListOperand because
it is abstract. You are probably missing an @Uses annotation while
invoking public abstract
com.google.ads.api.services.datax.userlists.UserListReturnValue
com.google.ads.api.services.datax.adwordsuserlist.AdwordsUserListService.mutate(java.util.List)
throws com.google.ads.api.services.common.error.ApiException with params
[[com.google.ads.api.services.datax.adwordsuserlist.v201502.jaxbgen.UserListOperation@16687106]].'
My source code:
#!/usr/bin/python
#coding=UTF-8
from datetime import date
from datetime import datetime
from datetime import timedelta
from googleads import adwords
(...)
def createNewList(client, list_a, list_b):
# Initialize appropriate service.
adwords_user_list_service = client.GetService(
'AdwordsUserListService', version='v201502')
rules = [
{
'ruleOperands': [list_a],
'operator': 'ALL'
},
{
'ruleOperands': [list_b],
'operator': 'NONE'
}
]
# Create the user list with no restrictions on site visit date.
combination_user_list = {
'xsi_type': 'LogicalUserList',
'name': 'Bouncers list created at %s'
% datetime.today().strftime('%Y%m%d %H:%M:%S'),
'description': 'Users who visited list A but not B',
'rules': rules
#'startDate': today.strftime('%Y%m%d'),
#'endDate': end_date.strftime('%Y%m%d')
}
# Create operations to add the user lists.
operations = [
{
'operand': user_list,
'operator': 'ADD',
} for user_list in [combination_user_list]
]
# Submit the operations.
user_lists = adwords_user_list_service.mutate(operations)
# Display results.
for user_list in user_lists['value']:
print (('User list added with ID %d, name "%s", status "%s", list type'
' "%s", accountUserListStatus "%s", description "%s".') %
(user_list['id'], user_list['name'],
user_list['status'], user_list['listType'],
user_list['accountUserListStatus'], user_list['description']))
adwords_client = adwords.AdWordsClient.LoadFromStorage()
createNewList(adwords_client, list_a, list_b)
With list_a and list_b being lists I previously created.
Can anybody tell me what's wrong?
Alternatively, how is it possible to reproduce the "Visitors of a page who
did not visit another page" behaviour with the API? The only way seemed to
used combination lists but even is failing (see the error above)...
Thanks for your help,
Damien
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at http://groups.google.com/group/adwords-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/b901096d-7163-4f66-b99c-cb3d28dac86a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.