Use Twisted's getPage as urlopen?

Posted by RadiantHex on Stack Overflow See other posts from Stack Overflow or by RadiantHex
Published on 2010-04-27T10:48:20Z Indexed on 2010/04/27 12:53 UTC
Read the original article Hit count: 237

Filed under:
|
|
|
|

Hi folks,

I would like to use Twisted non-blocking getPage method within a webapp, but it feels quite complicated to use such function compared to urlopen.

This is an example of what I'm trying to achive:

def web_request(request):
   response = urllib.urlopen('http://www.example.org')
   return HttpResponse(len(response.read()))

Is it so hard to have something similar with getPage?

© Stack Overflow or respective owner

Related posts about python

Related posts about twisted