Client¶
- class yarsaw.Client(authorization)¶
Represents an async client object used to connect with the API.
- Parameters
authorization (
str
) – Your Random Stuff API Key to be used to authorize the connection.
- async get_ai_response(message, *, plan='free', **kwargs)¶
Fetches ai responses from the API.
- async canvas(method, save_to=None, txt=None, text=None, img1=None, img2=None, img3=None)¶
Edit Images with the API.
- Parameters
method (
str
) –The method to be used to edit the image.
Allowed Methods:
Method(s) in which only 1 image is required: “affect”, “beautiful”, “wanted”, “delete”, “trigger”, “facepalm”, “blur”, “hitler”, “kiss”, “jail”, “invert”, “jokeOverHead”
Method(s) in which 2 images are required: “bed”, “fuse” , “kiss”, “slap”, “spank”
Method(s) in which 3 images are required: “distracted”
Method(s) in which only Text is required: “changemymind”
save_to (Optional[
str
]) – The path to save the edited image to. If not specified, the edited image will be returned as bytes.txt (Optional[
str
]) – The text required for your method.text (Optional[
str
]) – The text required for your method. Alias of txt.img1 (Optional[
str
]) – The path/link to the first image.img2 (Optional[
str
]) – The path/link to the second image.img3 (Optional[
str
]) – The path/link to the third image.
- Returns
If save_to is not specified, the edited image will be returned as bytes. If save_to is specified, the edited image will be saved to the specified path, and will return the image.
- Return type
Union[
bytes
,io.BufferedImage
]
- async get_covid_stats(country=None)¶
Fetch covid stats from the API.
- async get_covid_stats_by_country(country)¶
Fetch covid stats from the API by country.
- async get_fact(*, plan, fact_type='all')¶
Fetches facts from the API.
- async get_image(img_type)¶
Fetches images from the API.
- async get_joke(joke_type='any', blacklist=[])¶
Fetches jokes from the API.
- Parameters
joke_type (Optional[
str
]) – The type of joke you want to fetch. Allowed Values: “any”, “dark”, “pun”, “spooky”, “christmas”, “programming”, “misc”blacklist (Optional[
list
]) – A list of types jokes you want to blacklist. Allowed Values: “all”, “nsfw”, “religious”, “political”, “racist”, “sexist”, “explicit”
- Returns
A dictionary containing the joke.
- Return type
- async get_safe_joke(joke_type='any')¶
Fetches safe jokes from the API. These jokes are family-friendly.
- async get_waifu(waifu_type, *, plan)¶
Fetches waifus from the API.
- async get_weather(city)¶
Fetches weather data from the API.
- async disconnect()¶
Disconnects the client from the API.
- async restart()¶
Restarts the client’s connection with the API.
- async connect()¶
Connects the client to the API, incase it’s not already connected.
Pages¶
Welcome to YARSAW! - The main page of the documentation
Client - Explains how to use the client - the main class [Very Important]