port1900.uri
Nex URI representation and parsing.
NEX_DEFAULT_PORT
module-attribute
The default TCP network port for the Nex protocol.
NEX_PREFIX
module-attribute
NEX_PREFIX: Final[str] = f'{NEX_SCHEME}://'
The standard prefix for Nex URIs.
NEX_SCHEME
module-attribute
The default URL scheme for the Nex protocol.
NexURI
Represents a validated Nex protocol URI.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str | NexURI
|
The raw URI string or an existing NexURI to clone. |
required |
Raises:
| Type | Description |
|---|---|
URIError
|
If the URI is empty, the scheme is missing or not 'nex', the host is missing or invalid, or if parsing of the URI fails. |
request_bytes
property
request_bytes: bytes
Return the path payload bytes sent over TCP to the Nex server.
request_path
property
request_path: str
The resource path sent to the server (without leading slash).
request_string
property
request_string: str
Return the path payload string sent over TCP to the Nex server.
from_string
classmethod
replace
replace(
*,
host: str | _UnsetType = _UNSET,
port: int | _UnsetType = _UNSET,
path: str | _UnsetType = _UNSET,
) -> Self
Create a new NexURI by replacing specific parts of this URI.
resolve
resolve(relative_uri: str) -> Self
Resolve a relative URI string against this URI as a base.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
The relative or absolute target URI string. |
required |
Returns:
| Type | Description |
|---|---|
Self
|
A new NexURI representing the resolved target. |
Raises:
| Type | Description |
|---|---|
URIError
|
If resolution fails or target is invalid. |
with_default_scheme
classmethod
Add the Nex scheme to a URI if it is missing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
The URI string to check and potentially modify. |
required |
Returns:
| Type | Description |
|---|---|
Self
|
A new NexURI instance with the scheme added if it was missing. |
Raises:
| Type | Description |
|---|---|
URIError
|
If the URI is invalid or missing required components. |