Forked from limata3/create-draft-campaign-adwords-API.py
Created
February 1, 2021 19:40
-
-
Save Sandy4321/01236d4c8f5fc6c05cc19eda4dc2a25c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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