module documentation
(source)

HTTP client.
Class ​Agent Agent is a very basic HTTP client. It supports HTTP and HTTPS scheme URIs.
Class ​Browser​Like​Policy​For​HTTPS SSL connection creator for web clients.
Class ​Browser​Like​Redirect​Agent An Agent wrapper which handles HTTP redirects in the same fashion as web browsers.
Class ​Content​Decoder​Agent An Agent wrapper to handle encoded content.
Class ​Cookie​Agent CookieAgent extends the basic Agent to add RFC-compliant handling of HTTP cookies. Cookies are written to and extracted from a cookielib.CookieJar instance.
Class ​File​Body​Producer FileBodyProducer produces bytes from an input file object incrementally and writes them to a consumer.
Class ​Gzip​Decoder A wrapper for a Response instance which handles gzip'ed body.
Class ​Hostname​Caching​HTTPSPolicy IPolicyForHTTPS that wraps a IPolicyForHTTPS and caches the created IOpenSSLClientConnectionCreator.
Class ​HTTPClient​Factory Download a given URL.
Class ​HTTPConnection​Pool A pool of persistent HTTP connections.
Class ​HTTPDownloader Download to a file.
Class ​HTTPPage​Downloader Undocumented
Class ​HTTPPage​Getter Gets a resource via HTTP, then quits.
Class ​Partial​Download​Error Page was only partially downloaded, we got disconnected in middle.
Class ​Proxy​Agent An HTTP agent able to cross HTTP proxies.
Class ​Redirect​Agent An Agent wrapper which handles HTTP redirects.
Class ​Request​Generation​Failed There was an error while creating the bytes which make up a request.
Class ​Request​Transmission​Failed There was an error while sending the bytes which make up a request.
Class ​Response A Response instance describes an HTTP response received from an HTTP server.
Class ​Response​Done ResponseDone may be passed to IProtocol.connectionLost on the protocol passed to Response.deliverBody and indicates that the entire response has been delivered.
Class ​Response​Failed ResponseFailed indicates that all of the response to a request was not received for some reason.
Class ​Response​Never​Received A ResponseFailed that knows no response bytes at all have been received.
Class URI A URI object.
Class ​Web​Client​Context​Factory This class is deprecated. Please simply use Agent as-is, or if you want to customize something, use BrowserLikePolicyForHTTPS.
Function download​Page Download a web page to a file.
Function get​Page Download a web page as a string.
Function read​Body Get the body of an IResponse and return it as a byte string.
Function urlunparse Undocumented
Constant SSL Undocumented
Class _​Agent​Base Base class offering common facilities for Agent-type classes.
Class _​Context​Factory​With​Context A _ContextFactoryWithContext is like a twisted.internet.ssl.ContextFactory with a pre-created context.
Class _​Deprecated​To​Current​Policy​For​HTTPS Adapt a web context factory to a normal context factory.
Class _​Fake​Urllib2​Request A fake urllib2.Request object for cookielib to work with.
Class _​Fake​Urllib2​Response A fake urllib2.Response object for cookielib to work with.
Class _​Gzip​Protocol A Protocol implementation which wraps another one, transparently decompressing received data.
Class _​HTTP11​Client​Factory A factory for HTTP11ClientProtocol, used by HTTPConnectionPool.
Class _​Read​Body​Protocol Protocol that collects data sent to it.
Class _​Retrying​HTTP11​Client​Protocol A wrapper for HTTP11ClientProtocol that automatically retries requests.
Class _​Standard​Endpoint​Factory Standard HTTP endpoint destinations - TCP for HTTP, TCP+TLS for HTTPS.
Function _deprecate​Get​Page​Classes Mark the protocols and factories associated with getPage and downloadPage as deprecated.
Function _make​Getter​Factory Create and connect an HTTP page getting factory.
Function _require​SSL The decorated method requires pyOpenSSL to be present, or it raises NotImplementedError.
Function _urljoin No summary
Constant _GETPAGE​_REPLACEMENT​_TEXT Undocumented
def downloadPage(url, file, contextFactory=None, *args, **kwargs): (source)
Download a web page to a file.
Parameters
urlUndocumented
file

path to file on filesystem, or file-like object.

See HTTPDownloader to see what extra args can be passed.

context​FactoryUndocumented
*argsUndocumented
**kwargsUndocumented
def getPage(url, contextFactory=None, *args, **kwargs): (source)

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.

def readBody(response): (source)

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:IResponse providerThe HTTP response for which the body will be read.
Returns
A Deferred which will fire with the body of the response. Cancelling it will close the connection to the server immediately.
def urlunparse(parts): (source)

Undocumented

Undocumented

Value
None
def _deprecateGetPageClasses(): (source)
Mark the protocols and factories associated with getPage and downloadPage as deprecated.
def _makeGetterFactory(url, factoryFactory, contextFactory=None, *args, **kwargs): (source)

Create and connect an HTTP page getting factory.

Any additional positional or keyword arguments are used when calling factoryFactory.

Parameters
urlUndocumented
factory​FactoryFactory factory that is called with url, args and kwargs to produce the getter
context​FactoryContext factory to use when creating a secure connection, defaulting to None
*argsUndocumented
**kwargsUndocumented
Returns
The factory created by factoryFactory
def _requireSSL(decoratee): (source)
The decorated method requires pyOpenSSL to be present, or it raises NotImplementedError.
Parameters
decoratee:callableA function which requires pyOpenSSL.
Returns
callableA function which raises NotImplementedError if pyOpenSSL is not installed; otherwise, if it is installed, simply return decoratee.
def _urljoin(base, url): (source)

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:bytesBase URL.
url:bytesURL to combine with base.
Returns
An absolute URL resulting from the combination of base and url.
See Also
urllib.parse.urljoin()
https://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-22#section-7.1.2
_GETPAGE_REPLACEMENT_TEXT: str = (source)

Undocumented

Value
'https://pypi.org/project/treq/ or twisted.web.client.Agent'