Is there a way to limit the number of requests that urlfetch makes to any single server, per time unit?
I accidentally DoS'd a site I was crawling, since the async urlfetch api made it branch out until it died (each request spawns more than one new request on average). The logs contain ~200 DeadlineExceeded
with a millisecond between each.
You could use
time.sleep()
method. Suspend execution of the current thread for the given number of seconds.https://docs.python.org/2/library/time.html#time.sleep