Friday, February 19, 2010

twisted framework

Modified getPage () to return a factory and deferred, so that we when extract the return cookies.

from twisted.web import client
def getNewPage(url, contextFactory=None, *args, **kwargs):
Download a web page as a string and return clientfactory.
Download a page. Return a deferred, which will callback with a
page (as a string) or errback with a description of the error.

See HTTPClientFactory to see what extra args can be passed.
factory = client._makeGetterFactory(url,client.HTTPClientFactory, contextFactory=contextFactory, *args, **kwargs)
return factory.deferred, factory

No comments:

Post a Comment