예제 #1
0
  print(f'Creating HTML creative for buyer account ID "{account_id}":')
  try:
    # Construct and execute the request.
    response = (realtimebidding.buyers().creatives().create(
        parent=_BUYER_NAME_TEMPLATE % account_id, body=creative).execute())
  except HttpError as e:
    print(e)
    sys.exit(1)

  pprint.pprint(response)


if __name__ == '__main__':
  try:
    service = util.GetService(version='v1')
  except IOError as ex:
    print(f'Unable to create realtimebidding service - {ex}')
    print('Did you specify the key file in util.py?')
    sys.exit(1)

  default_snippet_content = (
      '<iframe marginwidth=0 marginheight=0 height=600 frameborder=0 '
      'width=160 scrolling=no src=\"https://test.com/ads?id=123456'
      '&curl=%%CLICK_URL_ESC%%&wprice=%%WINNING_PRICE_ESC%%\"></iframe>')

  parser = argparse.ArgumentParser(
      description=('Creates an HTML creative for the given buyer account ID.'))

  # Required fields.
  parser.add_argument(
예제 #2
0
import util


def main(ad_exchange_buyer):
    # Construct the request.
    request = ad_exchange_buyer.directDeals().list()

    # Execute request and print response.
    response = request.execute()
    if 'directDeals' in response:
        deals = response['directDeals']
        for deal in deals:
            pprint.pprint(deal)
    else:
        print 'No direct deals found'


if __name__ == '__main__':
    try:
        service = util.GetService()
    except IOError, ex:
        print 'Unable to create adexchangebuyer service - %s' % ex
        print 'Did you specify the key file in util.py?'
        sys.exit()
    except AccessTokenRefreshError, ex:
        print 'Unable to create adexchangebuyer service - %s' % ex
        print 'Did you set the correct Service Account Email in util.py?'
        sys.exit()

    main(service)