twisted.web.client module documentationtwisted.web
          View Source
          
        
      HTTP client.
| Function | urlunparse | Undocumented | 
| Class | PartialDownloadError | Page was only partially downloaded, we got disconnected in middle. | 
| Class | HTTPPageGetter | Gets a resource via HTTP, then quits. | 
| Class | HTTPPageDownloader | Undocumented | 
| Class | HTTPClientFactory | Download a given URL. | 
| Class | HTTPDownloader | Download to a file. | 
| Class | URI | A URI object. | 
| Function | getPage | Download a web page as a string. | 
| Function | downloadPage | Download a web page to a file. | 
| Class | Response | A Responseinstance describes an HTTP response received from an HTTP server. | 
| Class | ResponseDone | ResponseDonemay be passed toIProtocol.connectionLoston the protocol passed toResponse.deliverBodyand indicates that the entire response has been delivered. | 
| Class | ResponseFailed | ResponseFailedindicates that all of the response to a request was not received for some 
reason. | 
| Class | WebClientContextFactory | This class is deprecated.  Please simply use Agentas-is, or if 
you want to customize something, useBrowserLikePolicyForHTTPS. | 
| Class | BrowserLikePolicyForHTTPS | SSL connection creator for web clients. | 
| Class | FileBodyProducer | FileBodyProducerproduces bytes from an input file object incrementally and writes them to a
consumer. | 
| Class | HTTPConnectionPool | A pool of persistent HTTP connections. | 
| Class | Agent | Agentis a very
basic HTTP client.  It supports HTTP and HTTPS scheme 
URIs. | 
| Class | ProxyAgent | An HTTP agent able to cross HTTP proxies. | 
| Class | CookieAgent | CookieAgentextends the basicAgentto add 
RFC-compliant handling of HTTP cookies.  Cookies are written to and 
extracted from acookielib.CookieJarinstance. | 
| Class | GzipDecoder | A wrapper for a Responseinstance 
which handles gzip'ed body. | 
| Class | ContentDecoderAgent | An Agentwrapper to handle encoded content. | 
| Class | RedirectAgent | An Agentwrapper which handles HTTP redirects. | 
| Class | BrowserLikeRedirectAgent | An Agentwrapper which handles HTTP redirects in the same fashion as web 
browsers. | 
| Function | readBody | Get the body of an IResponseand 
return it as a byte string. | 
| Function | _urljoin | No summary | 
| Function | _makeGetterFactory | Create and connect an HTTP page getting factory. | 
| Function | _requireSSL | The decorated method requires pyOpenSSL to be present, or it raises NotImplementedError. | 
| Class | _ContextFactoryWithContext | A _ContextFactoryWithContextis like atwisted.internet.ssl.ContextFactorywith a pre-created context. | 
| Class | _DeprecatedToCurrentPolicyForHTTPS | Adapt a web context factory to a normal context factory. | 
| Class | _HTTP11ClientFactory | A factory for HTTP11ClientProtocol,
used byHTTPConnectionPool. | 
| Class | _RetryingHTTP11ClientProtocol | A wrapper for HTTP11ClientProtocolthat automatically retries requests. | 
| Class | _AgentBase | Base class offering common facilities for Agent-type 
classes. | 
| Class | _StandardEndpointFactory | Standard HTTP endpoint destinations - TCP for HTTP, TCP+TLS for HTTPS. | 
| Class | _FakeUrllib2Request | A fake urllib2.Requestobject forcookielibto
work with. | 
| Class | _FakeUrllib2Response | A fake urllib2.Responseobject forcookielibto work with. | 
| Class | _GzipProtocol | A Protocolimplementation which wraps another one, transparently decompressing 
received data. | 
| Class | _ReadBodyProtocol | Protocol that collects data sent to it. | 
Construct a full ("absolute") URL by combining a "base URL" with another URL. Informally, this uses components of the base URL, in particular the addressing scheme, the network location and (part of) the path, to provide missing components in the relative URL.
Additionally, the fragment identifier is preserved according to the HTTP 1.1 bis draft.
| Parameters | base | Base URL. (type: bytes) | 
| url | URL to combine with base. (type:bytes) | |
| Returns | An absolute URL resulting from the combination of baseandurl. | |
| See Also | urlparse.urljoin | |
| https://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-22#section-7.1.2 | ||
Create and connect an HTTP page getting factory.
Any additional positional or keyword arguments are used when calling 
factoryFactory.
| Parameters | factoryFactory | Factory factory that is called with url,argsandkwargsto produce the getter | 
| contextFactory | Context factory to use when creating a secure connection, defaulting to None | |
| Returns | The factory created by factoryFactory | |
Download a web page as a string.
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 arguments can be passed.
Download a web page to a file.
| Parameters | file | path to file on filesystem, or file-like object. See HTTPDownloader to see what extra args can be passed. | 
The decorated method requires pyOpenSSL to be present, or it raises NotImplementedError.
| Parameters | decoratee | A function which requires pyOpenSSL. (type: callable) | 
| Returns | A function which raises NotImplementedErrorif pyOpenSSL is not installed; otherwise, if it is installed, simply returndecoratee. (type:callable) | |
Get the body of an IResponse and 
return it as a byte string.
This is a helper function for clients that don't want to incrementally receive the body of an HTTP response.
| Parameters | response | The HTTP response for which the body will be read. (type: IResponseprovider) | 
| Returns | A Deferredwhich will fire with the body of the response. Cancelling it will close the
connection to the server immediately. | |