slowly package

Subpackages

Submodules

slowly.auth module

class slowly.auth.Auth(token=None)[source]

Bases: object

async check_token()[source]
async login(email: str)[source]

slowly.client module

class slowly.client.Client(*, loop: AbstractEventLoop | None = None, **options: Any)[source]

Bases: object

async close() None[source]

Close the client.

dispatch(event: str, *args: Any, **kwargs: Any) None[source]

Dispatch an event to the appropriate handlers.

event(coro: Callable) Callable[source]

Register an event coroutine.

async fetch_client_profile() None[source]

Fetch the client profile.

async fetch_friends() List[User][source]

Fetch the list of friends.

async fetch_passcode(email: str) None[source]

Fetch the passcode for the given email.

async fetch_token(email: str, passcode: str) str[source]

Fetch the token for the given email and passcode.

is_ready() bool[source]

Check if the client is ready.

async login(token: str) None[source]

Login to the client using a token.

async main() None[source]

Main function to be overridden by subclasses.

async on_error(event_method: str, *args: Any, **kwargs: Any) None[source]

Handle errors during event execution.

run(*args: Any, **kwargs: Any) Any | None[source]

Run the client.

async start(*args: Any, **kwargs: Any) None[source]

Start the client.

wait_for(event: str, *, check: Callable | None = None, timeout: float | None = None) Future[source]

Wait for a specific event to occur.

async wait_until_ready() None[source]

Wait until the client is ready.

slowly.errors module

exception slowly.errors.ClientException[source]

Bases: SlowlyException

exception slowly.errors.Forbidden(response, message)[source]

Bases: HTTPException

exception slowly.errors.HTTPException(response, message)[source]

Bases: SlowlyException

exception slowly.errors.InvalidData[source]

Bases: ClientException

exception slowly.errors.LoginFailure[source]

Bases: ClientException

exception slowly.errors.NotFound(response, message)[source]

Bases: HTTPException

exception slowly.errors.SlowlyException[source]

Bases: Exception

slowly.http module

class slowly.http.HTTPClient(connector: BaseConnector | None = None, *, proxy: str | None = None, proxy_auth: BasicAuth | None = None, loop: AbstractEventLoop | None = None)[source]

Bases: object

async close() None[source]

Close the HTTP session.

async fetch_auth_passcode(email: str) Coroutine[Any, Any, dict[str, Any] | str][source]

Fetch the authentication passcode.

Parameters:

email (str) – The email address.

Returns:

The coroutine for the request.

Return type:

Coroutine

async fetch_auth_token(email: str, passcode: str) Coroutine[Any, Any, dict[str, Any] | str][source]

Fetch the authentication token.

Parameters:
  • email (str) – The email address.

  • passcode (str) – The passcode.

Returns:

The coroutine for the request.

Return type:

Coroutine

fetch_client_profile() Coroutine[Any, Any, dict[str, Any] | str][source]

Get the client’s profile.

Returns:

The coroutine for the request.

Return type:

Coroutine

fetch_friends(requests: int = 1, dob: bool = True) Coroutine[Any, Any, dict[str, Any] | str][source]

Get the list of friends.

Parameters:
  • requests (int, optional) – The number of friend requests, by default 1.

  • dob (bool, optional) – Whether to include date of birth, by default True.

Returns:

The coroutine for the request.

Return type:

Coroutine

fetch_user_letters(friend_id: int, page: int = 1) Coroutine[Any, Any, dict[str, Any] | str][source]

Fetch letters from a specific friend.

Parameters:
  • friend_id (int) – The friend’s ID.

  • page (int, optional) – The page number, by default 1.

Returns:

The coroutine for the request.

Return type:

Coroutine

async login(token: str) None[source]

Login with the provided token.

Parameters:

token (str) – The authentication token.

async recreate() None[source]

Recreate the HTTP session if it is closed.

async request(route: Route, **kwargs: Any) dict[str, Any] | str[source]

Make an HTTP request.

Parameters:
  • route (Route) – The route object containing method and URL.

  • kwargs (Any) – Additional arguments for the request.

Returns:

The response data.

Return type:

dict[str, Any] or str

Raises:
  • Forbidden – If the response status is 403.

  • NotFound – If the response status is 404.

  • HTTPException – For other HTTP errors.

  • RuntimeError – If the code is unreachable.

class slowly.http.Route(method: str, path: str, **params: Any)[source]

Bases: object

BASE = 'https://api.getslowly.com/'
async slowly.http.json_or_text(response: ClientResponse) Dict[str, Any] | str[source]

Parse the response as JSON if possible, otherwise return as text.

Parameters:

response (aiohttp.ClientResponse) – The response object to parse.

Returns:

The parsed JSON data or text.

Return type:

dict[str, Any] or str

slowly.state module

class slowly.state.ConnectionState(*, dispatch, handlers, http, loop, **options)[source]

Bases: object

call_handlers(key, *args, **kwargs)[source]
clear()[source]
store_user(user)[source]

slowly.types module

Module contents

class slowly.Client(*, loop: AbstractEventLoop | None = None, **options: Any)[source]

Bases: object

async close() None[source]

Close the client.

dispatch(event: str, *args: Any, **kwargs: Any) None[source]

Dispatch an event to the appropriate handlers.

event(coro: Callable) Callable[source]

Register an event coroutine.

async fetch_client_profile() None[source]

Fetch the client profile.

async fetch_friends() List[User][source]

Fetch the list of friends.

async fetch_passcode(email: str) None[source]

Fetch the passcode for the given email.

async fetch_token(email: str, passcode: str) str[source]

Fetch the token for the given email and passcode.

is_ready() bool[source]

Check if the client is ready.

async login(token: str) None[source]

Login to the client using a token.

async main() None[source]

Main function to be overridden by subclasses.

async on_error(event_method: str, *args: Any, **kwargs: Any) None[source]

Handle errors during event execution.

run(*args: Any, **kwargs: Any) Any | None[source]

Run the client.

async start(*args: Any, **kwargs: Any) None[source]

Start the client.

wait_for(event: str, *, check: Callable | None = None, timeout: float | None = None) Future[source]

Wait for a specific event to occur.

async wait_until_ready() None[source]

Wait until the client is ready.