[Twisted-Python] Passing additional arguments to errback

Laurens Van Houtven _ at lvh.io
Wed Sep 4 08:30:27 MDT 2013


Cześć Maciek :)

In general, you can pass extra arguments when you call addCallback(s) or
addErrback. They will get passed to the callback.

However, as a side note to that code example, do you understand the
difference between

.addCallbacks(cb, eb)

and:

.addCallback(cb).addErrback(eb)


and:

.addErrback(eb).addCallback(cb)

... Also, keep in mind that you only errback when there is an issue setting
up the connection. If the server successfully responds with an error (say,
a 404 Not Found, or something), the callback will be called with the
response object. So, your question doesn't make a lot of sense to me: if
the errback gets called, there's not really a response!

Also, if you want to do scraping with Twisted, consider looking at Scrapy,
a fully-featured web scraper that uses Twisted internally.

pozdrawiam
lvh
​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20130904/10898817/attachment-0002.html>


More information about the Twisted-Python mailing list