Making HTTP requests using Twisted
Manlio Perillo
manlio_perilloNO at SPAMlibero.it
Tue Jul 11 14:03:45 EDT 2006
Manlio Perillo ha scritto:
> [...]
> Here is a quick example, ABSOLUTELY NOT TESTED:
>
> class DownloadQueue(object):
> SIZE = 50
>
> def init(self):
> self.requests = [] # queued requests
> self.deferreds = [] # waiting requests
>
> def addRequest(self, url, timeout):
> if len(self.deferreds) >= sels.SIZE:
> # wait for completion of all previous requests
> DeferredList(self.deferreds
> ).addCallback(self._callback)
> self.deferreds = []
The deferreds list should be cleared in the _callback method, not here.
Please note that probably there are other bugs.
Regards Manlio Perillo
More information about the Python-list
mailing list