def main(client, budget_id, merchant_id):
  campaign_service = client.GetService('CampaignService', version='v201603')
  ad_group_service = client.GetService('AdGroupService', version='v201603')
  ad_group_ad_service = client.GetService('AdGroupAdService', version='v201603')

  # Create campaign
  campaign = {
      'name': 'Shopping campaign #%s' % uuid.uuid4(),
      # The advertisingChannelType is what makes this a shopping campaign
      'advertisingChannelType': 'SHOPPING',
      # Set portfolio budget (required)
      'budget': {
          'budgetId': budget_id
      },
      'biddingStrategyConfiguration': {
          'biddingStrategyType': 'MANUAL_CPC'
      },
      'settings': [
          # All shopping campaigns need a ShoppingSetting
          {
              'xsi_type': 'ShoppingSetting',
              'salesCountry': 'US',
              'campaignPriority': '0',
              'merchantId': merchant_id,
              # Set to "True" to enable Local Inventory Ads in your campaign.
              'enableLocal': True
          }
      ]
  }

  campaign_operations = [{
      'operator': 'ADD',
      'operand': campaign
  }]

  result = campaign_service.mutate(campaign_operations)

  for campaign in result['value']:
    print ('Campaign with name \'%s\' and ID \'%s\' was added.'
           % (campaign['name'], campaign['id']))

  # Create the AdGroup
  adgroup = {
      'campaignId': campaign['id'],
      'name': 'AdGroup #%s' % uuid.uuid4()
  }

  adgroup_operations = {
      'operator': 'ADD',
      'operand': adgroup
  }

  # Make the mutate request to add the AdGroup to the Shopping Campaign
  ad_group_result = ad_group_service.mutate(adgroup_operations)

  for adgroup in ad_group_result['value']:
    print ('AdGroup with name \'%s\' and ID \'%s\' was added.'
           % (adgroup['name'], adgroup['id']))

  # Create an AdGroup Ad
  adgroup_ad = {
      'adGroupId': adgroup['id'],
      # Create ProductAd
      'ad': {
          'xsi_type': 'ProductAd',
          'Ad.Type': 'ProductAd'
      }
  }

  ad_operation = {
      'operator': 'ADD',
      'operand': adgroup_ad
  }

  # Make the mutate request to add the ProductAd to the AdGroup
  ad_result = ad_group_ad_service.mutate([ad_operation])

  for adgroup_ad in ad_result['value']:
    print 'ProductAd with ID \'%s\' was added.' % adgroup_ad['ad']['id']
dataset/ETHPy150Open googleads/googleads-python-lib/examples/adwords/v201603/shopping/add_shopping_campaign.py/main/original