6

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:team@stackoverflow.com">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?

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.

  • What's an "highly unnatural rate" ? Is a request every 200ms "highly unnatural" ? – Denys Séguret Jun 18 '15 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. – Tim Stone Jun 18 '15 at 17:01
  • BTW thanks for the information that it's the load balancer, this explains why it's a different format. – Denys Séguret Jun 18 '15 at 18:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .