Welcome, and thank you for using this api wrapper! This wrapper is completely async! Please note that I am not the creator of some-random-api. I only made this api wrapper! I also want to thank ir-3 for helping me get started with this.
For any questions and support for the wrapper, you can visit the Discord support server
To begin with, you'll have to install the package by doing one of the following commands:
pip install -U sr_api
python -m pip -U install sr_api
Or you can install directly from source by doing one of the following commands:
pip install -U git+https://github.com/iDutchy/sr_api
python -m pip install -U git+https://github.com/iDutchy/sr_api
After that, you will have to create the client:
import sr_api
client = sr_api.Client() #Alternatively you can use your own aiohttp.ClientSession by passing session=yoursession to this
Or if you have premium, provide your premium key like this:
import sr_api
client = sr_api.Client("premium key here")
For future reference in this documentation: when referring to 'client' we refer to what has been defined above!
All available endpoints you can use.
Premium Endpoint Get a gif from voting someone away as the impostor
WARNING: The Image.url returned by this function will very likely not embed! You will have to use Image.read to get the bytes object and work from there! DO NOT SHARE THE URL EITHER SINCE IT CONTAINS YOUR PREMIUM KEY
Parameters:
- username (string): The name of the impostor
- avatar (string): The avatar url of the impostor
- impostor (boolean) Whether or not the ejected user was an impostor.
Return type: Image (object)
Premium Endpoint Get a gif of someone or something being petted.
WARNING: The Image.url returned by this function will very likely not embed! You will have to use Image.read to get the bytes object and work from there! DO NOT SHARE THE URL EITHER SINCE IT CONTAINS YOUR PREMIUM KEY
Parameters:
- avatar (string): The avatar url of the petted object.
Return type: Image (object)
Get a random animal image.
Available options: dog
, cat
, panda
, red_panda
, fox
, birb
, koala
, kangaroo
, racoon
, whale
, pikachu
Parameters:
- animal (string): The animal you want to get an image from.
Return type: Image (object)
Get a random animal fact.
Available options: cat
, dog
, koala
, fox
, bird
, elephant
, panda
, racoon
, kangaroo
, giraffe
, whale
Parameters:
- animal (string): The animal you want to get a random fact from.
Return type: string
Get a random bots token. These are not real and can not be used to make a real bot
Return type: string
Get a random funny gif.
Available options: wink
, pat
, hug
, face-palm
Parameters:
- option (string): The type of gif you want.
Return type: Image (object)
Talk with the chatbot.
Parameters:
- text (string): Your line to the bot.
Return type: string
Get the username history and UUID from a minecraft user.
Parameters:
- username (string): Name of the minecraft user.
Return type: MCuser (object)
Search for a pokemon in the pokedex. Note: You can search by name OR id, not both!
Parameters:
- name (string): Name of the pokémon.
- pokemon_id (int): ID of the pokemon
Return type: Pokemon (object)
Encode text in binary.
Parameters:
- text (string): Text you want to encode.
Return type: string
Decode binary to text.
Parameters:
- binary (string): Binary you want to decode.
Return type: string
Encode text in base64.
Parameters:
- text (string): Text you want to encode.
Return type: string
Decode base64 to text.
Parameters:
- text (string): Text you want to decode.
Return type: string
Get the lyrics from a song.
Parameters:
- title (string): Title of the song you want to get lyrics from.
- owo (bool): Wheter to OwOify the lyrics. Defaults to False
Return type: Lyrics (object)
Get a random meme.
Return type: Meme (object)
Get a random quote from an anime.
Return type: Quote (object)
Get a random joke.
Return type: string
Get the definition from a word.
Parameters:
- word (string): The word you want to define.
Return type: Definition (object)
Available options: gay
, wasted
, greyscale
, invert
, triggered
, blur
, blurple
, glass
, pixelate
, sepia
, invertgreyscale
, brightness
, threshold
, red
, green
, blue
, spin
WARNING: The Image.url returned by this function will very likely not embed! You will have to use Image.read to get the bytes object and work from there!
Parameters:
- option (string): The type of image manipulation you want to use.
- url (string): The url from the image you want to manipulate.
Return type: Image (object)
Generate a fake youtube comment.
WARNING: The Image.url returned by this function will very likely not embed! You will have to use Image.read to get the bytes object and work from there!
Parameters:
- avatar (string): The avatar you want to use.
- username (string): The username for the comment.
- comment (string): The content of the comment.
Return type: Image (object)
View a color.
WARNING: The Image.url returned by this function will very likely not embed! You will have to use Image.read to get the bytes object and work from there!
Parameters:
- color (string): The color you want an image of. Example: "123456"
Return type: Image (object)
Convert RGB to HEX
Parameters:
- color_hex (string): The RGB value you want to convert. Example: "255,255,255"
Return type: string
Convert HEX to RGB
Parameters:
- color_hex (string): The HEX value you want to convert. Example: "123456"
Return type: dict ("r", "g", "b")
Here is explained what attributes the returned objects have
The object returned from client.get_image()
, client.get_gif()
, client.youtube_comment()
and client.view_color()
The url of the image
This will return a bytes object from the image
Locally save the image.
Note: 'filepath' requires a full path! e.g. /home/John/myimage.png
The object returned from client.get_lyrics()
The title of the song
The author of the song
The full lyrics of the song
A thumbnail of the song
A link to the songs Genius page
This will locally save a .txt
file of the lyrics
The object returned from client.get_meme()
The ID of the meme
URL of the meme's image
Description of the meme
The category the meme belongs to
Locally save an image of the meme.
Note: 'filepath' requires a full path! e.g. /home/John/meme.png
The object returned from client.mc_user()
Minecraft username
The users UUID
This will return a list of dicts with the users name history and date it was changed.
A pre formatted list of the users name history
A pre formatted list of the users name history in reversed order
The object returned from client.anime_quote()
The characters quote
The character the quote is from
The anime show the character/quote is from
The object returned from client.define()
The word that is being defined
The definition of the word
The object returned from client.get_pokemon()
The name of the pokémon
The ID of the pokémon
Returns a list of the types
Returns a list of the pokémons abilities
The pokémons height
The pokémons weight
The base experience of the pokémon
Returns a list of the pokémons genders
Returns a list of the pokémons egg groups
The pokémons HP stats
The pokémons Attack stats
The pokémons Defense stats
The pokémons Special Attack stats
The pokémons Special Defense stats
The pokémons Speed stats
The pokémons total stats
The pokémons evolution stage
Returns a list of the pokémons evolution line
A .png
url of the pokémons character
A .gif
url of the pokémons character
A description of the pokémon
The generation the pokémon is from