googleads / google-ads-python

Google Ads API Client Library for Python
Apache License 2.0
503 stars 477 forks source link

Upgrading problem #835

Closed miguelem closed 7 months ago

miguelem commented 7 months ago

My app was working OK a few weeks ago, but now it's giving me the error "Version v13 is deprecated. Requests to this version will be blocked."

So I updated the Google Ads API for Python (using "pip install --upgrade google-ads"). Now I have the latest version installed, but the app still gives me the v13 error.

I've been searching in my code and I can't find anywhere where I mention "v13", "version" or anything related, so I guess it's designed to use the latest version available (v15 now I guess). But my app seems to be still trying to use v13 for some reason.

Any clues to solve this? It could be a temporary cache/token issue or do I have to make changes in my code?

Thanks!

P.S.: I've asked the same thing on https://developers.google.com/google-ads/api/support and they sent me here.

BenRKarl commented 7 months ago

@miguelem there are basically 4 ways to set the API version when initializing the GoogleAdsClient class:

You could search your codebase for any patterns that might match the above. If your application truly is using version 23.0.0 of this library then there's no way it could default to v13 as that version isn't included in the list of available versions.

miguelem commented 7 months ago

Thanks @BenRKarl

There is no mention at all of "version" or "v13" in my (small) codebase. I've just searched again using "Find in files" in VS Code and also checked some key parts manually.

But it's still using v13. In the terminal, I see the following lines in the error message:

In one line:

"Method: /google.ads.googleads.v13.services.GoogleAdsService/SearchStream"

And almost at the end:

File "C:\Users\myuser\.virtualenvs\Django-Allauth-x4AvHHo-\Lib\site-packages\google\ads\googleads\v13\services\services\google_ads_service\client.py", line 3559, in search_stream
    response = rpc(

But I have no idea where this is coming from or how to change it (I'm a noob).

If I do pip show google-ads it shows me Version: 23.0.0

Thanks again!

BenRKarl commented 7 months ago

@miguelem Thanks for these details.

Would it be possible to add a line to your application to print the library version at runtime? You can add the below, and I recommend putting the print statement as close to the request logic as possible:

import google.ads.googleads
print(google.ads.googleads.VERSION)

Why I'm interested in this - if your application really was installing version 23.0.0 of this library, then it wouldn't be able to even send a request to the v13 endpoint, because the services and request messages aren't present.

miguelem commented 7 months ago

That printed "21.0.0". After checking everything more carefully, I noticed that I updated the API version on a different environment. I updated the correct environment and now my app it's working OK (using v15 automatically), so it was 100% caused by my silly mistake.

I'm so sorry for wasting your time! Thanks a lot for your help and patience!

BenRKarl commented 7 months ago

@miguelem Not a waste at all, glad I could help!