Hello!
I run example python script from the attachment.
I use Googleads Api. 
It says me: "usage: example_get_campaigns_ads.py [-h] -c CUSTOMER_ID [-i 
CAMPAIGN_ID]
example_get_campaigns_ads.py: error: the following arguments are required: 
-c/--customer_id"

Screenshot: http://prntscr.com/nh995v

What -c/--customer_id arguments should I add and where to put it in?
How to fix the problem?

Thank you for attention!

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/678d9988-e485-455b-8693-008bd882774e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
from __future__ import absolute_import

import sys
sys.path.append('c:\\users\\rp\\miniconda3\\lib\\site-packages')
print(sys.path)

import argparse
import six
import sys
import google.ads.google_ads.client


_DEFAULT_PAGE_SIZE = 1000


def main(client, customer_id, page_size, campaign_id=None):
    ga_service = client.get_service('GoogleAdsService', version='v1')

    query = 'SELECT campaign.id, ad_group.id, ad_group.name FROM ad_group'

    if campaign_id:
        query = '%s WHERE campaign.id = %s' % (query, campaign_id)

    results = ga_service.search(customer_id, query=query, page_size=page_size)

    try:
        for row in results:
            print('Ad group with ID %d and name "%s" was found in campaign '
                  'with ID %d.'
                  % (row.ad_group.id.value, row.ad_group.name.value,
                     row.campaign.id.value))
    except google.ads.google_ads.errors.GoogleAdsException as ex:
        print('Request with ID "%s" failed with status "%s" and includes the '
              'following errors:' % (ex.request_id, ex.error.code().name))
        for error in ex.failure.errors:
            print('\tError with message "%s".' % error.message)
            if error.location:
                for field_path_element in error.location.field_path_elements:
                    print('\t\tOn field: %s' % field_path_element.field_name)
        sys.exit(1)


if __name__ == '__main__':
    # GoogleAdsClient will read the google-ads.yaml configuration file in the
    # home directory if none is specified.
    google_ads_client = (google.ads.google_ads.client.GoogleAdsClient
                         .load_from_storage())

    parser = argparse.ArgumentParser(
        description='List ad groups for specified customer.')
    # The following argument(s) should be provided to run the example.
    parser.add_argument('-c', '--customer_id', type=six.text_type,
                        required=True, help='The Google Ads customer ID.')
    parser.add_argument('-i', '--campaign_id', type=six.text_type,
                        required=False,
                        help=('The campaign ID. Specify this to list ad groups '
                              'solely for this campaign ID.'))
    args = parser.parse_args()

    main(google_ads_client, args.customer_id, _DEFAULT_PAGE_SIZE,
         campaign_id=args.campaign_id)
  • error: ... Dmitry Shvetsov
    • RE... googleadsapi-forumadvisor via AdWords API and Google Ads API Forum

Reply via email to