Hi All, 

I use the Google Ads API to upload a user list using the 
'OfflineUserDataJobService' and then I change the membership lifespan to 
540 days using 'UserListService' and 'UserListOperation', more of the code 
is below. 

After the initial run on my Google Ads Test Account the user/audience list 
uploads perfectly fine. Including the correct membership lifespan (540 
Days). After about 1-2 Days the Audience List is closed and the membership 
lifespan reads (1 Day).

Is this happening because it is a test account? Or is there another issue 
altogether?

Thanks!

Function for changing User list membership lifespan:
def update_user_list_membership_lifespan(client, customer_id, list_id, 
mem_life_span, status, app_id=None):
    """Creates a User List using the name provided.
    Args:
      client: The Google Ads client instance.
      customer_id: The customer ID for which to add the user list.
      list_name: The name of the user list to search.
      list_type: The type of customer list (based on 
CustomerMatchUploadKeyType).
      app_id: App ID required only for mobile advertising lists.
    Returns:
      The User List resource name.
    """
    print(f'The user list {list_id} will have mem_life_spn updated.')
    user_list_service = client.get_service('UserListService')
    user_list_operation = client.get_type('UserListOperation')

    # Creates the new user list.
    user_list = user_list_operation.update
    
    user_list.resource_name = f"customers/{customer_id}/userLists/{list_id}"

    user_list.membership_life_span = mem_life_span
    
    user_list.membership_status = status
    
    client.copy_from(
        user_list_operation.update_mask,
        protobuf_helpers.field_mask(None, user_list._pb),
    )

    user_list_response = user_list_service.mutate_user_lists(
        customer_id=customer_id, operations=[user_list_operation]
    )
    user_list_resource_name = user_list_response.results[0].resource_name
    print(
        f'User list with resource name "{user_list_resource_name}" was 
updated.')
    return user_list_resource_name

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/3d14ead6-ef3e-4c50-a598-b311303e6ef4n%40googlegroups.com.

Reply via email to