Skip to content

port1900.response

Response object for port1900.

Response dataclass

Response(
    uri: NexURI, raw_bytes: bytes, encoding: str = "utf-8"
)

Represents a response received from a Nex server.

content property

content: bytes

Raw response bytes.

encoding class-attribute instance-attribute

encoding: str = 'utf-8'

Encoding used to decode text (default: 'utf-8').

is_directory property

is_directory: bool

True if the requested URI represents a directory.

lines cached property

lines: list[str]

Response text split into lines.

mime_type cached property

mime_type: str

Inferred MIME type based on the requested URI path extension.

Defaults to 'text/plain' if no MIME type can be inferred or if there is no extension.

raw_bytes instance-attribute

raw_bytes: bytes

Raw bytes received from the server.

text cached property

text: str

Response content decoded as text.

Performs a decode using encoding. If a UnicodeDecodeError is raised, falls back to iso8859-1, and if that raises an error falls back to errors="replace".

uri instance-attribute

uri: NexURI

The requested Nex URI.