diff --git a/samples/adexchangebuyer/get_creative.py b/samples/adexchangebuyer/get_creative.py index e2b2da9..ffa3385 100644 --- a/samples/adexchangebuyer/get_creative.py +++ b/samples/adexchangebuyer/get_creative.py @@ -19,7 +19,8 @@ Tags: creatives.insert """ -__author__ = 'david.t@google.com (David Torres)' +__author__ = ('david.t@google.com (David Torres)', + 'jdilallo@google.com (Joseph DiLallo)') import pprint import sys @@ -32,11 +33,6 @@ gflags.DEFINE_string('account_id', None, 'The ID of the account that contains the creative', short_name='a') gflags.MarkFlagAsRequired('account_id') -gflags.DEFINE_string('adgroup_id', None, - 'The pretargeting adgroup id to which the creative is ' - 'associated with', - short_name='g') -gflags.MarkFlagAsRequired('adgroup_id') gflags.DEFINE_string('buyer_creative_id', None, 'A buyer-specific id that identifies this creative', short_name='c') @@ -46,7 +42,6 @@ gflags.MarkFlagAsRequired('buyer_creative_id') def main(argv): sample_utils.process_flags(argv) account_id = gflags.FLAGS.account_id - adgroup_id = gflags.FLAGS.adgroup_id buyer_creative_id = gflags.FLAGS.buyer_creative_id pretty_printer = pprint.PrettyPrinter() @@ -56,7 +51,6 @@ def main(argv): try: # Construct the request. request = service.creatives().get(accountId=account_id, - adgroupId=adgroup_id, buyerCreativeId=buyer_creative_id) # Execute request and print response. diff --git a/samples/adexchangebuyer/sample_utils.py b/samples/adexchangebuyer/sample_utils.py index 89f95ff..7083efa 100644 --- a/samples/adexchangebuyer/sample_utils.py +++ b/samples/adexchangebuyer/sample_utils.py @@ -108,5 +108,5 @@ def initialize_service(): http = credentials.authorize(http) # Construct a service object via the discovery service. - service = build('adexchangebuyer', 'v1', http=http) + service = build('adexchangebuyer', 'v1.2', http=http) return service diff --git a/samples/adexchangebuyer/submit_creative.py b/samples/adexchangebuyer/submit_creative.py index 1052eae..abba2e3 100644 --- a/samples/adexchangebuyer/submit_creative.py +++ b/samples/adexchangebuyer/submit_creative.py @@ -19,7 +19,8 @@ Tags: creatives.insert """ -__author__ = 'david.t@google.com (David Torres)' +__author__ = ('david.t@google.com (David Torres)', + 'jdilallo@google.com (Joseph DiLallo)') import pprint import sys @@ -32,22 +33,20 @@ gflags.DEFINE_string('account_id', None, 'The ID of the account to which submit the creative', short_name='a') gflags.MarkFlagAsRequired('account_id') -gflags.DEFINE_string('adgroup_id', None, - 'The pretargeting adgroup id that this creative will be ' - 'associated with', - short_name='g') -gflags.MarkFlagAsRequired('adgroup_id') gflags.DEFINE_string('buyer_creative_id', None, 'A buyer-specific id identifying the creative in this ad', short_name='c') gflags.MarkFlagAsRequired('buyer_creative_id') +gflags.DEFINE_string('agency_id', None, + 'The id of the agency who created this ad', + short_name='g') def main(argv): sample_utils.process_flags(argv) account_id = gflags.FLAGS.account_id - adgroup_id = gflags.FLAGS.adgroup_id buyer_creative_id = gflags.FLAGS.buyer_creative_id + agency_id = gflags.FLAGS.agency_id pretty_printer = pprint.PrettyPrinter() # Authenticate and construct service. @@ -57,7 +56,6 @@ def main(argv): # Create a new creative to submit. creative_body = { 'accountId': account_id, - 'adgroupId': adgroup_id, 'buyerCreativeId': buyer_creative_id, 'HTMLSnippet': ('' 'Hi there!'), @@ -66,6 +64,8 @@ def main(argv): 'height': 250, 'advertiserName': 'google' } + if agency_id: + creative_body['agencyId'] = agency_id creative = service.creatives().insert(body=creative_body).execute() # Print the response. If the creative has been already reviewed, its status # and categories will be included in the response.