[Twisted-Python] Setting a timeout for HTTPDownloader

Philippe Lafoucrière lafou at wanadoo.fr
Tue Aug 12 10:28:16 EDT 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