Skip to main content

fishaudio.core.client_wrapper

HTTP client wrapper for managing requests and authentication.

BaseClientWrapper Objects

Base wrapper with shared logic for sync/async clients.

get_headers

Build headers including authentication and user agent.

ClientWrapper Objects

Wrapper for httpx.Client that handles authentication and error handling.

request

Make an HTTP request with error handling. Arguments:
  • method - HTTP method (GET, POST, etc.)
  • path - API endpoint path
  • request_options - Optional request-level overrides
  • **kwargs - Additional arguments to pass to httpx.request
Returns: httpx.Response object Raises:
  • APIError - On non-2xx responses

client

Get underlying httpx.Client for advanced usage (e.g., WebSockets).

close

Close the HTTP client.

AsyncClientWrapper Objects

Wrapper for httpx.AsyncClient that handles authentication and error handling.

request

Make an async HTTP request with error handling. Arguments:
  • method - HTTP method (GET, POST, etc.)
  • path - API endpoint path
  • request_options - Optional request-level overrides
  • **kwargs - Additional arguments to pass to httpx.request
Returns: httpx.Response object Raises:
  • APIError - On non-2xx responses

client

Get underlying httpx.AsyncClient for advanced usage (e.g., WebSockets).

close

Close the HTTP client.

fishaudio.core.request_options

Request-level options for API calls.

RequestOptions Objects

Options that can be provided on a per-request basis to override client defaults. Attributes:
  • timeout - Override the client’s default timeout (in seconds)
  • max_retries - Override the client’s default max retries
  • additional_headers - Additional headers to include in the request
  • additional_query_params - Additional query parameters to include

get_timeout

Convert timeout to httpx.Timeout if set.

fishaudio.core.iterators

Audio stream wrappers with collection utilities.

AudioStream Objects

Wrapper for sync audio byte streams with collection utilities. This class wraps an iterator of audio bytes and provides a convenient .collect() method to gather all chunks into a single bytes object. Examples:

__init__

Initialize the audio iterator wrapper. Arguments:
  • iterator - The underlying iterator of audio bytes

__iter__

Allow direct iteration over audio chunks.

collect

Collect all audio chunks into a single bytes object. This consumes the iterator and returns all audio data as bytes. After calling this method, the iterator cannot be used again. Returns: Complete audio data as bytes Examples:

AsyncAudioStream Objects

Wrapper for async audio byte streams with collection utilities. This class wraps an async iterator of audio bytes and provides a convenient .collect() method to gather all chunks into a single bytes object. Examples:

__init__

Initialize the async audio iterator wrapper. Arguments:
  • async_iterator - The underlying async iterator of audio bytes

__aiter__

Allow direct async iteration over audio chunks.

collect

Collect all audio chunks into a single bytes object. This consumes the async iterator and returns all audio data as bytes. After calling this method, the iterator cannot be used again. Returns: Complete audio data as bytes Examples:

fishaudio.core.websocket_options

WebSocket-level options for WebSocket connections.

WebSocketOptions Objects

Options for configuring WebSocket connections. These options are passed directly to httpx_ws’s connect_ws/aconnect_ws functions. For complete documentation, see https://frankie567.github.io/httpx-ws/reference/httpx_ws/ Attributes:
  • keepalive_ping_timeout_seconds - Maximum delay the client will wait for an answer to its Ping event. If the delay is exceeded, WebSocketNetworkError will be raised and the connection closed. Default: 20 seconds.
  • keepalive_ping_interval_seconds - Interval at which the client will automatically send a Ping event to keep the connection alive. Set to None to disable this mechanism. Default: 20 seconds.
  • max_message_size_bytes - Message size in bytes to receive from the server.
  • Default - 65536 bytes (64 KiB).
  • queue_size - Size of the queue where received messages will be held until they are consumed. If the queue is full, the client will stop receiving messages from the server until the queue has room available. Default: 512.
Notes: Parameter descriptions adapted from httpx_ws documentation.

to_httpx_ws_kwargs

Convert to kwargs dict for httpx_ws aconnect_ws/connect_ws.

fishaudio.core.omit

OMIT sentinel for distinguishing None from not-provided parameters.