HttpxClientFactory
autogen.a2a.HttpxClientFactory #
HttpxClientFactory(*, auth=None, params=None, headers=None, cookies=None, verify=True, cert=None, http1=True, http2=False, proxy=None, mounts=None, timeout=DEFAULT_TIMEOUT_CONFIG, follow_redirects=False, limits=DEFAULT_LIMITS, max_redirects=DEFAULT_MAX_REDIRECTS, event_hooks=None, base_url='', transport=None, trust_env=True, default_encoding='utf-8', **kwargs)
Bases: ClientFactory
An asynchronous HTTP client factory, with connection pooling, HTTP/2, redirects, cookie persistence, etc.
It can be shared between tasks.
Usage:
>>> factory = HttpxClientFactory()
>>> async with factory() as client:
>>> response = await client.get('https://example.org')
Parameters:
- auth - (optional) An authentication class to use when sending requests.
- params - (optional) Query parameters to include in request URLs, as a string, dictionary, or sequence of two-tuples.
- headers - (optional) Dictionary of HTTP headers to include when sending requests.
- cookies - (optional) Dictionary of Cookie items to include when sending requests.
- verify - (optional) Either
True
to use an SSL context with the default CA bundle,False
to disable verification, or an instance ofssl.SSLContext
to use a custom context. - http2 - (optional) A boolean indicating if HTTP/2 support should be enabled. Defaults to
False
. - proxy - (optional) A proxy URL where all the traffic should be routed.
- timeout - (optional) The timeout configuration to use when sending requests.
- limits - (optional) The limits configuration to use.
- max_redirects - (optional) The maximum number of redirect responses that should be followed.
- base_url - (optional) A URL to use as the base when building request URLs.
- transport - (optional) A transport class to use for sending requests over the network.
- trust_env - (optional) Enables or disables usage of environment variables for configuration.
- default_encoding - (optional) The default encoding to use for decoding response text, if no charset information is included in a response Content-Type header. Set to a callable for automatic character set detection. Default: "utf-8".
Source code in autogen/remote/httpx_client_factory.py
options instance-attribute
#
options = {'auth': auth, 'params': params, 'headers': headers, 'cookies': cookies, 'verify': verify, 'cert': cert, 'http1': http1, 'http2': http2, 'proxy': proxy, 'mounts': mounts, 'timeout': timeout, 'follow_redirects': follow_redirects, 'limits': limits, 'max_redirects': max_redirects, 'event_hooks': event_hooks, 'base_url': base_url, 'transport': transport, 'trust_env': trust_env, 'default_encoding': default_encoding, None: kwargs}