def getPage(url, contextFactory=None, response_transform=None, *args, **kwargs):
 def _clientfactory(url, *args, **kwargs):
  url = to_unicode(url)
  timeout = kwargs.pop('timeout', 0)
  f = client.ScrapyHTTPClientFactory(Request(url, *args, **kwargs), timeout=timeout)
  f.deferred.addCallback((response_transform or (lambda r: r.body)))
  return f
 from twisted.web.client import _makeGetterFactory
 return _makeGetterFactory(to_bytes(url), _clientfactory, contextFactory=contextFactory, *args, **kwargs).deferred

def getPage ( url , contextFactory = None , response_transform = None , * args , ** kwargs ) : def _clientfactory ( url , * args , ** kwargs ) : url = to_unicode ( url ) timeout = kwargs . pop ( 'timeout' , 0 ) f = client . ScrapyHTTPClientFactory ( Request ( url , * args , ** kwargs ) , timeout = timeout ) f . deferred . addCallback ( ( response_transform or ( lambda r : r . body ) ) ) return f from twisted . web . client import _makeGetterFactory return _makeGetterFactory ( to_bytes ( url ) , _clientfactory , contextFactory = contextFactory , * args , ** kwargs ) . deferred
download a web page as a string .