Google Ads API: How to catch the 504 Deadline Exceeded error (Python)

829 views
Skip to first unread message

Mat

unread,
Apr 23, 2019, 9:18:18 AM4/23/19
to AdWords API and Google Ads API Forum
Hi,

I keep getting the occational 504 Deadline Exceeded error while using the Google Ads API, where I never got this error before while using the AdWords API (for the same tasks).
There seems to be no pattern and usually I can't reproduce the error. It occures randomly in about one of several hundred queries, but some of them are crucial. So I want to catch this error, wait a minute and send the request again. But I'm struggling with how to catch this error.

I've tried somthing like this, but it won't catch this type of error but raises the error immediately without retry:

  for i in range(4):                    
    try:
      results = ga_service.search(customer_id, query=query, page_size=PAGE_SIZE)
      break
    except Exception as error:
      print("Error on try %s: %s" % (i,  error))
      if i == 3:
        raise
      else:
        time.sleep(60)
        continue  
    except:
      print("Error on try %s" % (i))
      if i == 3:
        raise
      else:
        time.sleep(60)
        continue          

What's wrong?

Regards
Mat

googleadsapi...@google.com

unread,
Apr 23, 2019, 3:51:28 PM4/23/19
to m...@keyword-experte.de, AdWords API and Google Ads API Forum
Hi Mat,

Could you please send over through reply privately to author some of the API calls you are making that are resulting in this error?

Thanks,
Anthony
Google Ads API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    https://ads-developers.googleblog.com/search/label/google_ads_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscribe@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+unsubscribe@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/5d2e6fdd-22a5-48cc-a4f2-a07b362db101%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mat

unread,
Apr 25, 2019, 2:32:46 AM4/25/19
to AdWords API and Google Ads API Forum
Apparently we should never have to bother with this bug, because it should already be caught in the Python library. But there seems to be an issue:

 

Reply all
Reply to author
Forward
0 new messages