This document is for Kombu's development version, which can be significantly different from previous releases. Get the stable docs here: 5.0.
Async HTTP Client -
- kombu.asynchronous.http.Client(hub=None, **kwargs)¶
Create new HTTP client.
- class kombu.asynchronous.http.Headers¶
Represents a mapping of HTTP headers.
- complete = False¶
Set when all of the headers have been read.
- class kombu.asynchronous.http.Request(url, method='GET', on_ready=None, on_timeout=None, on_stream=None, on_prepare=None, on_header=None, headers=None, **kwargs)¶
A HTTP Request.
- Keyword Arguments
headers (Dict, Headers) – Optional headers for this request
body (str) – Optional body for this request.
connect_timeout (float) – Connection timeout in float seconds Default is 30.0.
timeout (float) – Time in float seconds before the request times out Default is 30.0.
follow_redirects (bool) – Specify if the client should follow redirects Enabled by default.
max_redirects (int) – Maximum number of redirects (default 6).
use_gzip (bool) – Allow the server to use gzip compression. Enabled by default.
validate_cert (bool) – Set to true if the server certificate should be verified when performing
https://requests. Enabled by default.
auth_username (str) – Username for HTTP authentication.
auth_password (str) – Password for HTTP authentication.
auth_mode (str) – Type of HTTP authentication (
user_agent (str) – Custom user agent for this request.
network_interace (str) – Network interface to use for this request.
on_ready (Callable) – Callback to be called when the response has been received. Must accept single
on_stream (Callable) – Optional callback to be called every time body content has been read from the socket. If specified then the response body and buffer attributes will not be available.
on_timeout (callable) – Optional callback to be called if the request times out.
on_header (Callable) – Optional callback to be called for every header line received from the server. The signature is
(headers, line)and note that if you want
response.headersto be populated then your callback needs to also call
on_prepare (Callable) – Optional callback that is implementation specific (e.g. curl client will pass the
curlinstance to this callback).
proxy_username (str) – Optional username to use when logging in to the proxy.
proxy_password (str) – Optional password to use when authenticating with the proxy server.
ca_certs (str) – Custom CA certificates file to use.
client_key (str) – Optional filename for client SSL key.
client_cert (str) – Optional filename for client SSL certificate.
- auth_mode = None¶
- auth_password = None¶
- auth_username = None¶
- body = None¶
- ca_certs = None¶
- client_cert = None¶
- client_key = None¶
- connect_timeout = 30.0¶
- follow_redirects = True¶
- max_redirects = 6¶
- network_interface = None¶
- proxy_host = None¶
- proxy_password = None¶
- proxy_port = None¶
- proxy_username = None¶
- request_timeout = 30.0¶
- then(callback, errback=None)¶
- use_gzip = True¶
- user_agent = None¶
- validate_cert = True¶
- class kombu.asynchronous.http.Response(request, code, headers=None, buffer=None, effective_url=None, error=None, status=None)¶
- property body¶
The full contents of the response body.
Accessing this property will evaluate the buffer and subsequent accesses will be cached.
- property content¶
Raise if the request resulted in an HTTP error code.
- property status_code¶