[Twisted-Python] Setting a timeout for HTTPDownloader
Philippe Lafoucrière
lafou at wanadoo.fr
Tue Aug 12 08:28:16 MDT 2003
You should set a var when the download starts :
> > myTimeout = 120 # seconds
self.started = False
> > def notifyDownloadStart(self, uri):
> > reactor.callLater(self.myTimeout, self._timeOut, uri)
> > # rest of notifyDownloadStart
# if download starts :
self.started = True
> >
> > def _timeOut(self, uri):
if self.started:
> > if self.downloaders.has_key(uri):
> > self.downloaders[uri].loseConnection()
More information about the Twisted-Python
mailing list