Http session factory
Create preconfigured sync and async HTTP clients for Eve Auth Manager.
async_client_manager(user_agent: str = USER_AGENT) -> AsyncIterator[AsyncClient]
async
¶
Yield a configured async HTTP client and close it automatically on exit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_agent
|
str
|
User-Agent header value to send with requests. |
USER_AGENT
|
Yields:
| Type | Description |
|---|---|
AsyncIterator[AsyncClient]
|
Configured asynchronous HTTP client. |
Source code in src/pfmsoft/eve_snippets/httpx2/http_session_factory.py
client_manager(user_agent: str = USER_AGENT) -> Iterator[Client]
¶
Yield a configured HTTP client and close it automatically on exit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_agent
|
str
|
User-Agent header value to send with requests. |
USER_AGENT
|
Yields:
| Type | Description |
|---|---|
Client
|
Configured synchronous HTTP client. |
Source code in src/pfmsoft/eve_snippets/httpx2/http_session_factory.py
config_async_http_client(user_agent: str = USER_AGENT) -> AsyncClient
async
¶
Create an async HTTP client configured with the project User-Agent header.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_agent
|
str
|
User-Agent header value to send with requests. Defaults to the project setting. |
USER_AGENT
|
Returns:
| Type | Description |
|---|---|
AsyncClient
|
Configured asynchronous HTTP client. |
Note
The caller owns the returned client and must close it when finished.
Source code in src/pfmsoft/eve_snippets/httpx2/http_session_factory.py
config_http_client(user_agent: str = USER_AGENT) -> Client
¶
Create an HTTP client configured with the project User-Agent header.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_agent
|
str
|
User-Agent header value to send with requests. Defaults to the project setting. |
USER_AGENT
|
Returns:
| Type | Description |
|---|---|
Client
|
Configured synchronous HTTP client. |
Note
The caller owns the returned client and must close it when finished.