port1900.client
Async Nex protocol client implementation.
DEFAULT_TIMEOUT
module-attribute
Default timeout in seconds for Nex network operations.
Client
Client(
*,
timeout: float | None = DEFAULT_TIMEOUT,
encoding: str = "utf-8",
)
An asynchronous client for the Nex protocol.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
float | None
|
Default timeout in seconds for requests, or None for no timeout. |
DEFAULT_TIMEOUT
|
|
str
|
Default character encoding for response text. |
'utf-8'
|
get
async
get(
target: str | NexURI,
*,
timeout: float | None = None,
encoding: str | None = None,
) -> Response
Alias for request.
request
async
request(
target: str | NexURI,
*,
timeout: float | None = None,
encoding: str | None = None,
) -> Response
Send a Nex request to a server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str | NexURI
|
Either a Nex target string (e.g. 'nex://example.com/hello.txt') or a NexURI. |
required |
|
float | None
|
Optional timeout override in seconds for this request. |
None
|
|
str | None
|
Optional character encoding override for decoding the response. |
None
|
Returns:
| Type | Description |
|---|---|
Response
|
A Response instance containing the server output and URI metadata. |
Raises:
| Type | Description |
|---|---|
URIError
|
If the target string cannot be parsed as a valid Nex URI. |
ConnectionError
|
If network connection to the server fails. |
TimeoutError
|
If the request times out. |