Skip to content

port79.client

Async Finger protocol client implementation.

DEFAULT_TIMEOUT module-attribute

DEFAULT_TIMEOUT: Final[float] = 10.0

Default timeout in seconds for Finger network operations.

Client

Client(
    *,
    timeout: float | None = DEFAULT_TIMEOUT,
    encoding: str = "utf-8",
)

An asynchronous client for the Finger protocol (RFC 1288).

Parameters:

Name Type Description Default

timeout

float | None

Default timeout in seconds for requests, or None for no timeout.

DEFAULT_TIMEOUT

encoding

str

Default character encoding for response text.

'utf-8'

encoding property

encoding: str

The default character encoding for decoding responses.

timeout property

timeout: float | None

The default timeout in seconds for requests.

__aenter__ async

__aenter__() -> Self

Enter the async context manager block.

Returns:

Type Description
Self

The Client instance itself.

__aexit__ async

__aexit__(
    exc_type: type[BaseException] | None,
    exc_val: BaseException | None,
    exc_tb: object | None,
) -> None

Exit the async context manager block.

request async

request(
    query: str | FingerURI,
    *,
    timeout: float | None = None,
    encoding: str | None = None,
) -> Response

Send a Finger query request to a server.

Parameters:

Name Type Description Default

query

str | FingerURI

Either a query target string (e.g. 'davep@plan.cat') or a FingerURI.

required

timeout

float | None

Optional timeout override in seconds for this request.

None

encoding

str | None

Optional character encoding override for decoding the response.

None

Returns:

Type Description
Response

A Response instance containing the server output and query metadata.

Raises:

Type Description
URIError

If the query string cannot be parsed as a valid Finger URI.

ConnectionError

If network connection to the server fails.

TimeoutError

If the request times out.