Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Sandy4321/01236d4c8f5fc6c05cc19eda4dc2a25c to your computer and use it in GitHub Desktop.
Save Sandy4321/01236d4c8f5fc6c05cc19eda4dc2a25c to your computer and use it in GitHub Desktop.
def create_draft():
adwords_client = connect_to_adwords_api()
draft_service = adwords_client.GetService('DraftService', version='v201809')
draft = {
'baseCampaignId': original_campaign_id,
'draftName': {draft_name}
}
draft_operation = {'operator': 'ADD', 'operand': draft}
draft = draft_service.mutate([draft_operation])['value'][0]
draft_campaign_id = draft['draftCampaignId']
draft_id = draft['draftId']
return draft_id, draft_campaign_id
# You may want to consider the draft name to be the original campaign name plus a common identifier of all of the drafts that will be included in this test, such as:
# draft_name = '{0}-Test_XYZ'.format({original_campaign_name})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment