Adsense Management API “Rate Limit Exceeded” error

202 views
Skip to first unread message

Claus

unread,
Apr 27, 2014, 10:15:19 PM4/27/14
to adsen...@googlegroups.com

Hello guys,

I'm facing the "Rate Limit Exceeded" error with Adsense management API. The problem clearly isn't with daily request quota, since I make very few requests and the overview in the Google API console also says the quota is fine, currently I see 3% of daily quota used and the requests per second chart shows maximum average requests per second for last day as 0.0444 requests/sec. At the time I'm writing this, it's about 9 hours until midnight PDT and I'm getting the error.

Even when I tried to push the request directly through the Google API console, I'm getting the error. The response shown when I send request through the API explorer in the API console is: "domain": "usageLimits", "reason": "rateLimitExceeded", "message": "Rate Limit Exceeded"

The error starts appearing at random times every day (usually just 1-2 hours before midnight, but sometimes as early as today, 9-10 hours before the end of the day) and disapears about 45 minutes after midnight PDT, effectively blocking me from generating any report through API until the quota reset at midnight. I have also set the Per-user limit to 10 requests/second/user (even though I'm not sending more than one request every few minutes) but it didn't help.


Does anyone have any clue how could I fix this and what could be the problem? I have absolutely no idea why this happens since I'm not sending many requests at once, and also not using the allowed 10000 requests/day quota almost at all, reports at developer's console say that the average is about 500 requests/day. 


Thanks to all for any input.

galeksic

unread,
Apr 29, 2014, 11:28:27 AM4/29/14
to adsen...@googlegroups.com
Even when I tried to push the request directly through the Google API console, I'm getting the error.
...
I have also set the Per-user limit to 10 requests/second/user (even though I'm not sending more than one request every few minutes)

Maybe stupid comment/suggestion (or it doesn't make some sense...) but I see in my code I had sleep(2) after execute(), so maybe I had same problem (I can't remember! :)

while True:
  events
= cfg_vars.service[cal_servicelist].events().list(
                                                   calendarId  
= cal_GCAL_ID,
                                                   maxResults  
= 100000,
                                                   showDeleted  
= False,
                                                   pageToken    
= page_token
                                                   
).execute()
  page_token
= events.get('nextPageToken', False)
  tokennumber
+= 1
#     sleep(2)
...


Claus

unread,
Apr 29, 2014, 12:10:31 PM4/29/14
to adsen...@googlegroups.com

Thanks for the suggestion, I'll try to add some sleep function, even though I'm not convinced that it will help, since I never send more than 2-3 requests at once and the limit is set to 10 requests per second. 

However the backoff is out of the question, when I start getting the error, it doesn't stop until the next midnight, no matter how long I wait between API requests.

Sérgio Gomes (AdSense API Team)

unread,
Apr 30, 2014, 12:31:03 PM4/30/14
to adsen...@googlegroups.com
Hi Claus,

You're likely running into the requests/second/user limit.

There are two ways you can tackle this:
Hope this helps!

Cheers,
Sérgio

---
Sérgio Gomes
Developer Relations

Google UK Limited
Registered Office: Belgrave House, 76 Buckingham Palace Road, London SW1W 9TQ
Registered in England Number: 3977902

Claus

unread,
Apr 30, 2014, 12:53:34 PM4/30/14
to adsen...@googlegroups.com

Hello Sergio,

yes, that's how it looks, however I have raised the limit of requests/second/user to 10 which is the maximum and recently, as galeksic suggested, I have also added a 2 second sleep time between each API request and it still didn't help. And also, I'm never sending more than 3 requests at once, so the requests/second/user should be more enough. At this point, I am also the only one who uses the application which makes use of the API, so there's only me requesting 2-3 API requests through the web application once per hour and still it sometimes ends up with the rate limit exceeded error... 

By the way, is there any way how to avoid the need of every message that I post to be manually reviewed by the moderator before it's posted? It takes a day or two before my messages appear here in the group.

Thanks.

Claus

Claus

unread,
Apr 30, 2014, 1:12:34 PM4/30/14
to adsen...@googlegroups.com
One more note, I'm only facing this problem in the last few weeks, maybe a month. I was using the same code in the same way for several months without any problem, this error only started to appear recently. 

Sérgio Gomes (AdSense API Team)

unread,
May 2, 2014, 10:41:48 AM5/2/14
to adsen...@googlegroups.com
Hey Claus,

Are you by any chance running very large reports? That could be another source of "rate limit exceeded" errors, and would explain why you'd suddenly start getting the issues (for example, if your account has grown).

Cheers,
Sérgio

---
Sérgio Gomes
Developer Relations

Google UK Limited
Registered Office: Belgrave House, 76 Buckingham Palace Road, London SW1W 9TQ
Registered in England Number: 3977902

Claus

unread,
May 2, 2014, 2:45:39 PM5/2/14
to adsen...@googlegroups.com

I see... Well, it depends on what "very large" is, but I'm mainly getting current day report for page views, clicks, CTR, CPC and earnings. It's true that all stats are going up very fast in the last 1-2 months as we are getting more traffic and page views so you might be right here. On the other hand, it's not that big, I don't want to break Adsense rules so I won't disclose any number just in case, but I think any popular blog or some similar site can reach the number of page views that we have, so it's not anything extreme.

Anyway, does it mean that if the report is large, I have no way how to get it through the API without triggering the rate limit? I.e. the the rate limit is triggered when I'm trying to get a report for more than some specific number of page views? 

Also I would say that the only report that triggers this error is report for today. I never had problems with report for the whole last month for example. As I am thinking about it, this is something that I might try to test next, I haven't tried if other reports besides today's report work when the today's report returns rate limit error.

Thanks,

Claus

Sérgio Gomes (AdSense API Team)

unread,
May 2, 2014, 3:23:42 PM5/2/14
to adsen...@googlegroups.com
Replied privately to follow up on what's happening in this specific case.

Cheers,
Sérgio

---
Sérgio Gomes
Developer Relations

Google UK Limited
Registered Office: Belgrave House, 76 Buckingham Palace Road, London SW1W 9TQ
Registered in England Number: 3977902

Claus

unread,
May 6, 2014, 3:00:21 PM5/6/14
to adsen...@googlegroups.com

Hello Sergio,

have you received my email? Because I didn't get anything back from you since I sent the email, maybe it ended up in your spam folder? If you don't have it, I can resend it.

Thanks and sorry for the inconvenience,

Claus

Kevin Dayton

unread,
Jul 17, 2014, 8:26:19 AM7/17/14
to adsen...@googlegroups.com
Hi Claus,

Did you ever have any luck in solving this?

Thanks
Reply all
Reply to author
Forward
0 new messages