Most socket request libraries have timeouts on connection attempts, have you looked into that already?
On Tue, Sep 15, 2009 at 4:02 PM, Serdar Tumgoren <zstumgo...@gmail.com>wrote: > Hey everyone, > Is there a way to break out of a function if it exceeds a certain time > limit for execution? > > There's a Website I'm scraping on a regular basis, and for some reason > that I can't divine the site has radically varying response times. In > some cases, I get a result vary quickly; at other times, my entire > program hangs because of this one call to an external source. Even > more strange, if I quit the scrape when it appears to hang and then > try it again a few moments later, it will sometimes work just fine > ("sometimes" being the key word). I'm not certain, but I'm guessing > this inconsistent behavior has something to do with the site that I'm > scraping. > > So again, is there a way to place a time limit on the execution of a > function, after which you can break out of it and then retry it or > move along with the rest of your program? > > TIA, > Serdar > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor >
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor