Redundant versioning in Google Ads API Python examples - are there better ways?

20 views
Skip to first unread message

Mat

unread,
Sep 8, 2020, 6:39:11 AM9/8/20
to AdWords API and Google Ads API Forum
Hi,

In your Python code example for "Create Customer" (and others). the versioning seems highly redundant to me:

def main(client, manager_customer_id):
    customer_service
= client.get_service("CustomerService", version="v5")
    customer
= client.get_type("Customer", version="v5")

I was wondering, if there is a way to set the version on a higher level, e.g. on the "google_ads_client" level when creating the object as in here:

google_ads_client = (
        google
.ads.google_ads.client.GoogleAdsClient.load_from_storage()
   
)

..or while importing the library:

import google.ads.google_ads.client

... or somwhere in the google-ads.yaml

I've seen some skripts where dozens of lines of code contain this ", version="vX" - part. I guess there is a smarter way - right?

Regards
Mat



Google Ads API Forum Advisor Prod

unread,
Sep 9, 2020, 2:47:50 PM9/9/20
to m...@keyword-experte.de, adwor...@googlegroups.com
Hey Mat,

I'd suggest bringing this up with the client library owners as this is more suited for them to provide insight on.

Regards,
Anthony
Google Ads API Team

Google Logo
Anthony Madrigal
Google Ads API Team
 


ref:_00D1U1174p._5004Q24ZcAe:ref

Mat

unread,
Sep 10, 2020, 1:35:55 AM9/10/20
to AdWords API and Google Ads API Forum
Hi Anthony,

I've just checked the Google Ads Python issue tracker and there already seems to exist a similar request. The last answer of the maintainer is "That's a good idea - we'll consider it for a future release." That was about half a year ago and to date, no assignments have been made. So currently, there does not seem to be a way to set the default api version.

Regards
Mat
Reply all
Reply to author
Forward
0 new messages