7

The API specifies error codes, and messages. It also specifies a "backoff" parameter.

But, even while respecting the backoff and stopping at errors, and even when waiting a long time between requests (180ms), I get this answer as HTML:

<html> 
  <head>
    <title>Too Many Requests - Stack Exchange</title>
  </head> 
  <body style="font-family:Arial,Helvetica,sans-serif;">
    <div style="margin: 0 auto; width: 960px;"> 
          <h2 >We're sorry...</h2>
          <p>There are an unusual number of requests coming from this IP address.</p>  
          <p>To protect our users, we can't process any more requests from this IP address right now.</p>
          <p>We'll restore access as quickly as possible, so try again soon.</p>  
          <p>If you believe you have reached this page in error, <a href="mailto:[email protected]">contact us</a>.</p> 
    </div>
  </body> 
</html> 

Why is it HTML ?

And how am I supposed to deal with that ?

Retry later ? When ?

Related: What's the proper way to fetch the score of all answers of SO?

5
  • This was supposed to have been fixed, but apparently not. Commented Jun 18, 2015 at 16:39
  • To be clear, you are waiting the amount of time specified by the backoff flag, and you are monitoring quota remaining too? Commented Jun 18, 2015 at 16:40
  • See also: stackapps.com/questions/1457/… Commented Jun 18, 2015 at 16:42
  • @BrockAdams With my current request I'm not asked to back off (or very rarely). Commented Jun 18, 2015 at 16:58
  • Even when quota_remaining=9281 , I just got this error 503 Service Unavailable "Too Many Requests - Stack Exchange". That's really confusing. Commented Sep 13, 2019 at 16:08

1 Answer 1

3

It sounds like you've either got a bug which is in fact making more requests than you think it is, or you're on a network where there's some other source of high-frequency requests.

You're not supposed to have to deal with this situation in general, because this isn't an API error - it's an error from the load balancer because your IP is generating incoming requests at a highly unnatural rate.

Usually this will go away in a few minutes, but I believe it generally depends on the level of detected abuse.

3
  • 1
    What's an "highly unnatural rate" ? Is a request every 200ms "highly unnatural" ? Commented Jun 18, 2015 at 16:58
  • I don't know the specifics, but a single request every 200ms should be fine, unless maybe you were doing it constantly for hours - I've never created that scenario, so I don't know what happens in that case. Typically this will happen if you've sent many requests in a very short period of time, like 1 every 1 ms or something. Commented Jun 18, 2015 at 17:01
  • BTW thanks for the information that it's the load balancer, this explains why it's a different format. Commented Jun 18, 2015 at 18:50

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.