def main(client, base_rate_id):
  # Initialize appropriate service.
  base_rate_service = client.GetService('BaseRateService', version='v201505')

  # Create a filter statement for base rates for a single rate card.
  values = [{
      'key': 'id',
      'value': {
          'xsi_type': 'NumberValue',
          'value': base_rate_id
      }
  }]
  query = 'where id = :id ORDER BY id ASC'
  statement = dfp.FilterStatement(query, values, 1)

  # Get single base rate by statement.
  response = base_rate_service.getBaseRatesByStatement(
      statement.ToStatement())

  if 'results' in response:
    # Update each local base rate object by changing its value to $3 USD.
    new_rate = {
        'currencyCode': 'USD',
        'microAmount': 3000000
    }

    updated_base_rates = []
    for base_rate in response['results']:
      base_rate['rate'] = new_rate
      updated_base_rates.append(base_rate)

    # Update base rates remotely.
    base_rates = base_rate_service.updateBaseRates(updated_base_rates)

    # Display results.
    if base_rates:
      for base_rate in base_rates:
        print ('Base rate with ID \'%s\' and type \'%s\' belonging to '
               'rate card ID \'%s\' was updated.' % (
                   base_rate['id'],
                   dfp.DfpClassType(base_rate),
                   base_rate['rateCardId']))
    else:
      print 'No base rates were updated.'
  else:
    print 'No base rates found to update.'
dataset/ETHPy150Open googleads/googleads-python-lib/examples/dfp/v201505/base_rate_service/update_base_rates.py/main/original