def main(client):
  # Initialize appropriate service.
  lica_service = client.GetService(
      'LineItemCreativeAssociationService', version='v201508')

  # Create statement object to get all LICAs.
  statement = dfp.FilterStatement()

  while True:
    # Get LICAs by statement.
    response = lica_service.getLineItemCreativeAssociationsByStatement(
        statement.ToStatement())

    if 'results' in response:
      # Update each local LICA object by changing its destination URL.
      updated_licas = []
      for lica in response['results']:
        lica['destinationUrl'] = 'http://news.google.com'
        updated_licas.append(lica)

      # Update LICAs remotely.
      licas = lica_service.updateLineItemCreativeAssociations(updated_licas)

      # Display results.
      for lica in licas:
        print ('LICA with line item id \'%s\', creative id \'%s\', and status '
               '\'%s\' was updated.' % (lica['lineItemId'], lica['creativeId'],
                                        lica['status']))
      statement.offset += dfp.SUGGESTED_PAGE_LIMIT
    else:
      break

  if response['totalResultSetSize'] == 0:
    print 'No LICAs found to update.'
dataset/ETHPy150Open googleads/googleads-python-lib/examples/dfp/v201508/line_item_creative_association_service/update_licas.py/main/original