base
Class info¶
Classes¶
| Name | Children | Inherits |
|---|---|---|
| AuthOptions anyenv.download.base Authentication options for HTTP requests. |
||
| DataRetrievalOptions anyenv.download.base Options of the module-level helpers: per-request options plus caching. |
||
| HttpResponse anyenv.download.base An HTTP response with its body already read. |
||
| RequestOptions anyenv.download.base Per-request options, also accepted by the methods of an `HttpSession`. |
||
| ResponseHeaders anyenv.download.base Read-only, case-insensitive mapping of HTTP response headers. |
🛈 DocStrings¶
Types and the response object of anyenv's HTTP functionality.
AuthOptions
¶
Bases: TypedDict
Authentication options for HTTP requests.
Source code in src/anyenv/download/base.py
DataRetrievalOptions
¶
Bases: RequestOptions
Options of the module-level helpers: per-request options plus caching.
Source code in src/anyenv/download/base.py
HttpResponse
¶
An HTTP response with its body already read.
A thin wrapper over the response of whichever httpx flavour is installed (httpx2 or httpx), so callers don't depend on the flavour.
Source code in src/anyenv/download/base.py
headers
property
¶
Response headers (case-insensitive, read-only; repeated headers joined by commas).
json
¶
validated_json
¶
Response body parsed as JSON and validated against a type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_type
|
type[T]
|
The type to validate the response against |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
If validation fails |
Source code in src/anyenv/download/base.py
RequestOptions
¶
Bases: AuthOptions
Per-request options, also accepted by the methods of an HttpSession.
Source code in src/anyenv/download/base.py
ResponseHeaders
¶
Bases: Mapping[str, str]
Read-only, case-insensitive mapping of HTTP response headers.
Lookups, membership tests, and .get() ignore case; iteration yields
lower-case header names in insertion order.
Source code in src/anyenv/download/base.py
open_download_target
¶
Open a download's target for writing, replacing it only on success.
Writes go to <path>.part, renamed onto the path when the block completes;
on an error the part file is removed and an existing file stays as it was.