Please Note Some of the source came from(with permission): Original Github Python wrapper for asuna.ga I am not the creator the asuna api, and some of this code came from the iDutchy some-random-api project so credits to them. Credits to iDutchy for the Original source.
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 asuna-api
python -m pip -U install asuna-api
Or you can install directly from source by doing one of the following commands:
pip install -U git+https://github.com/Senarc-Studios/asuna_api
python -m pip install -U git+https://github.com/Senarc-Studios/asuna_api
After that, you will have to create the client:
import asuna_api
client = asuna_api.Client() #Alternatively you can use your own aiohttp.ClientSession by passing session=yoursession to this
For future reference in this documentation: when referring to 'client' we refer to what has been defined above!
Also remember to await client.close() after you run your command(otherwise it may cause errors passing the session doesn't have this issue.)
All available endpoints you can use.
Get a random funny gif.
Available options: "hug"
,"kiss"
,"neko"
,"pat"
,"slap"
,"wholesome_foxes"
Parameters:
- option (string): The type of gif you want.
Return type: Image (object)
Get the username history and UUID from a minecraft user.
Parameters:
- username (string): Name of the minecraft user.
Return type: MCuser (object)
Get a random response from SP46's api
Parameters:
-number (string or int): Amount of random quotes(1-50), defaults to 1.
Return type: List
Here is explained what attributes the returned objects have
The object returned from client.get_gif()
The url of the image
This returns the full name of the file, however only for apis that return it, otherwise it may return as None.
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.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
Please note this is heavily based on the sra wrapper code the mcUser object itself is the exact same as that api however with TimeChangedAt added.
This returns the dictionary but as a list of datetime objects
This returns a list of objects that the library can use to later make it easier to handle stuff rather than doing [""] or .get[""] you can use the attributes(check the source for that)
doing:
name will return name as str
changed_at will return a datetime type
time_changed_at also returns a datetime type