aio_microservice.http¶
Classes¶
Usage docs: https://docs.pydantic.dev/2.7/concepts/models/ |
|
An asynchronous HTTP client, with connection pooling, HTTP/2, redirects, |
Module Contents¶
- class aio_microservice.http.HttpSettings(/, **data)[source]¶
Bases:
pydantic.BaseModel
Usage docs: https://docs.pydantic.dev/2.7/concepts/models/
A base class for creating Pydantic models.
- Parameters:
data (Any)
- __class_vars__¶
The names of classvars defined on the model.
- __private_attributes__¶
Metadata about the private attributes of the model.
- __signature__¶
The signature for instantiating the model.
- __pydantic_complete__¶
Whether model building is completed, or if there are still undefined fields.
- __pydantic_core_schema__¶
The pydantic-core schema used to build the SchemaValidator and SchemaSerializer.
- __pydantic_custom_init__¶
Whether the model has a custom __init__ function.
- __pydantic_decorators__¶
Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.
- __pydantic_generic_metadata__¶
Metadata for generic models; contains data used for a similar purpose to __args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these.
- __pydantic_parent_namespace__¶
Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_post_init__¶
The name of the post-init method for the model, if defined.
- __pydantic_root_model__¶
Whether the model is a RootModel.
- __pydantic_serializer__¶
The pydantic-core SchemaSerializer used to dump instances of the model.
- __pydantic_validator__¶
The pydantic-core SchemaValidator used to validate instances of the model.
- __pydantic_extra__¶
An instance attribute with the values of extra fields from validation when model_config[‘extra’] == ‘allow’.
- __pydantic_fields_set__¶
An instance attribute with the names of fields explicitly set.
- __pydantic_private__¶
Instance attribute with the values of private attributes set on the model instance.
- port: aio_microservice.types.Port¶
- class aio_microservice.http.TestHttpClient(service)[source]¶
Bases:
litestar.testing.AsyncTestClient
[litestar.Litestar
]An asynchronous HTTP client, with connection pooling, HTTP/2, redirects, cookie persistence, etc.
It can be shared between tasks.
Usage:
`python >>> async with httpx.AsyncClient() 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) SSL certificates (a.k.a CA bundle) used to verify the identity of requested hosts. Either True (default CA bundle), a path to an SSL certificate file, an ssl.SSLContext, or False (which will disable verification). * cert - (optional) An SSL certificate used by the requested host to authenticate the client. Either a path to an SSL certificate file, or two-tuple of (certificate file, key file), or a three-tuple of (certificate file, key file, password). * 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. * proxies - (optional) A dictionary mapping HTTP protocols to proxy URLs. * 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. * app - (optional) An ASGI application to send requests to, rather than sending actual network requests. * 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”.
- Parameters:
service (ServiceT)