twisted.web getPage-- retrieving error information
![](https://secure.gravatar.com/avatar/37bc4d6e5a625d85328a2f04548544c7.jpg?s=120&d=mm&r=g)
Hi folks, I am tryign to get useful error information when I use twisted.web.getPage. For example, this code doesn't supply a trailing slash when making a request for www.google.com. This causes getPage to make an invalid request to the web server ("GET HTTP/1.1") which causes the server to disconnect immediately (that's true for the google web server. for apache, it produces an "Invalid Request" message and error code). It doens't seem like the error object passed to the errback contains any useful information which I can bubble up to the user. For example, I'd like to know what data was received before the server closed the connection. ANy ideas? from twisted.internet import reactor from twisted.web.client import getPage def gotPage(result): print "gotPage: result=", result def gotPageErr(error): print "gotPageErr: error=", error def getAPage(url): gp = getPage(url) gp.addCallback(gotPage) gp.addErrback(gotPageErr) reactor.callWhenRunning(getAPage, "http://google.com") reactor.run()
participants (1)
-
David E. Konerding