SlyMastodon.public#

Mastodon client for public API

Classes

MastodonPublic(instance_url[, auth])

Mastodon client for public API

class SlyMastodon.public.MastodonPublic(instance_url: str, auth: OAuth2 | None = None)#

Bases: WebAPI

Mastodon client for public API

base_url: str#
await user(at_or_id: str) User#

Lookup an account by ID or username @user : defaults to the current domain @user@domain : any other domain

await delete_json(path: str, params: Mapping[str, int | str | Enum | None | Set[ParamType] | Sequence[ParamType]] | None = None, json: Any = None, headers: dict[str, str] | None = None)#
await get_form(path: str, params: Mapping[str, int | str | Enum | None | Set[ParamType] | Sequence[ParamType]] | None = None, data: Any | None = None, headers: dict[str, str] | None = None) dict[str, int | float | bool | str | None | list['JsonType'] | dict[str, 'JsonType']]#
get_full_url(path: str) str#

Convert a relative path to an absolute url for this API

await get_json(path: str, params: Mapping[str, int | str | Enum | None | Set[ParamType] | Sequence[ParamType]] | None = None, json: dict[str, int | float | bool | str | None | list['JsonType'] | dict[str, 'JsonType']] | None = None, headers: dict[str, str] | None = None) dict[str, int | float | bool | str | None | list['JsonType'] | dict[str, 'JsonType']]#
await get_post(post_id: str) Post#

Get a post by ID

await get_text(path: str, params: Mapping[str, int | str | Enum | None | Set[ParamType] | Sequence[ParamType]] | None = None, json: dict[str, int | float | bool | str | None | list['JsonType'] | dict[str, 'JsonType']] | None = None, headers: dict[str, str] | None = None) str#
paginated(path: str, params: Mapping[str, int | str | Enum | None | Set[ParamType] | Sequence[ParamType]], limit: int | None) AsyncLazy[dict[str, int | float | bool | str | None | list['JsonType'] | dict[str, 'JsonType']]]#

Return an awaitable and async iterable over google or twitter-style paginated items. You can also await the return value to get the entire list.

await post_form(path: str, params: Mapping[str, int | str | Enum | None | Set[ParamType] | Sequence[ParamType]] | None = None, data: Any | None = None, headers: dict[str, str] | None = None) dict[str, int | float | bool | str | None | list['JsonType'] | dict[str, 'JsonType']]#
await post_form_empty(path: str, params: Mapping[str, int | str | Enum | None | Set[ParamType] | Sequence[ParamType]] | None = None, data: Any | None = None, headers: dict[str, str] | None = None)#
await post_json(path: str, params: Mapping[str, int | str | Enum | None | Set[ParamType] | Sequence[ParamType]] | None = None, json: dict[str, int | float | bool | str | None | list['JsonType'] | dict[str, 'JsonType']] | None = None, headers: dict[str, str] | None = None) dict[str, int | float | bool | str | None | list['JsonType'] | dict[str, 'JsonType']]#
await post_json_empty(path: str, params: Mapping[str, int | str | Enum | None | Set[ParamType] | Sequence[ParamType]] | None = None, json: dict[str, int | float | bool | str | None | list['JsonType'] | dict[str, 'JsonType']] | None = None, headers: dict[str, str] | None = None)#
await put_form(path: str, params: Mapping[str, int | str | Enum | None | Set[ParamType] | Sequence[ParamType]] | None = None, data: Any | None = None, headers: dict[str, str] | None = None) dict[str, int | float | bool | str | None | list['JsonType'] | dict[str, 'JsonType']]#
await put_json(path: str, params: Mapping[str, int | str | Enum | None | Set[ParamType] | Sequence[ParamType]] | None = None, json: dict[str, int | float | bool | str | None | list['JsonType'] | dict[str, 'JsonType']] | None = None, headers: dict[str, str] | None = None) dict[str, int | float | bool | str | None | list['JsonType'] | dict[str, 'JsonType']]#
auth: Auth#