API Reference¶
Client¶
- class mystbin.Client(*, session: ClientSession | None = None, root_url: str = 'https://mystb.in')[source]¶
The main client class that interacts with the mystb.in API.
- Parameters:
session (Optional[
aiohttp.ClientSession]) – The session to use for the HTTP requests. If not provided, a new session will be created.root_url (
str) – The root URL for the mystbin instance. Defaults tohttps://mystb.in.
- await close() None[source]¶
This function is a coroutine.
Closes the internal HTTP session and this client.
- await create_paste(*, files: Sequence[File], password: str | None = None, expires: datetime.datetime | None = None) Paste[source]¶
This function is a coroutine.
Create a single file paste on mystb.in.
- Parameters:
files (List[
File]) – The pre-creates list of files you wish to upload.password (Optional[
str]) – The password of the paste, if any.expires (Optional[
datetime.datetime]) – When the paste expires, if any.
- Returns:
The paste that was created.
- Return type:
- await delete_paste(security_token: str, /) None[source]¶
This function is a coroutine.
Delete a paste.
- Parameters:
security_token (
str) – The security token relating to the paste to delete.
- await get_paste(paste_id: str, *, password: str | None = None, raw: Literal[False]) Paste[source]¶
- await get_paste(paste_id: str, *, password: str | None = None, raw: Literal[True]) list[str]
- await get_paste(paste_id: str, *, password: str | None = None) Paste
This function is a coroutine.
Fetch a paste.
Paste¶
- class mystbin.Paste[source]¶
Represents a Paste object from mystbin instances.
- created_at¶
When this paste was created in UTC.
- Type:
- files¶
The list of files within this Paste.
- Type:
List[
mystbin.File]
- property expires: datetime | None¶
When the paste expires, if at all.
- Return type:
Optional[
datetime.datetime]
- await delete() None[source]¶
This function is a coroutine.
This method will delete this paste from the mystbin instance.
- Raises:
ValueError – The paste requires the security token to be present.