API reference#
Client#
This is the base asyncdagpi client you use to make requests.
This example initalises a basic client.
from asyncdagpi import Client
client = Client("your token")
Tip
You can also disable logging
from asyncdagpi import Client
client = Client(token, logging=False)
You can also setup a more advance client by passing in your own aiohttp ClientSession and Event Loop. If you are using discord.py it is adviseable to use the bot.loop as the event loop.
Warning
Please use this only if you know what you are doing. Do not use the aiohttp session used by discord.py.
from asyncndagpi import Client
loop = #Your Asyncio Event Loop
session = #Your Aiohttp session
client = Client(token, loop=loop, session=session)
Below is all of the methods of the client.
Client#
- class asyncdagpi.Client(token: str, *, session: Optional[ClientSession] = None, loop: Optional[AbstractEventLoop] = None)[source]#
Client for interacting with asyncdagpi.
- token#
Your Dagpi Api token
- Type
str
- session#
an aiohttp ClientSession for dagpi to use
- Type
Optional[
aiohttp.ClientSession
]
- loop#
an asyncio event loop for the asyncdagpi to use
- Type
Optional[
asyncio.AbstractEventLoop
]
- .. note::
This will initialise an AsyncDagpiClient that you can use for making requests. It is recommended to re-use the Client.
- ..note::
The
aiohttp.ClientSession
passed via constructor will have headers and authentication set. Do not pass one you plan to re-use for other things, lest you leak your login data.
- property ratelimits: Ratelimits#
Get ratelimits for your client
- await image_process(feature: ImageFeatures, url: str, **kwargs: Any) Image [source]#
This function is a coroutine.
- Parameters
feature (
ImageFeature
) – a dagpi ImageFeature classurl (
str
) – the Url for the Image Passedkwargs – based on the Docs for your Feature chose the right extra kwargs like text or username
- Returns
Asyncdagpi Image Object
- Return type
- await special_image_process(url: str) Image [source]#
This function is a coroutine.
- Parameters
url (
str
) – the Url for the Image Passed- Returns
Asyncdagpi Image Object
- Return type
- await wtp() WTP [source]#
get a WTP data object :returns:
asyncdagpi.WTP
- await logo() Logo [source]#
This function is a coroutine. get a Logo data object
- Returns
logo object
- Return type
- await roast() str [source]#
This function is a coroutine. Returns a string with a Roast
- Return type
str
- await yomama() str [source]#
This function is a coroutine. Returns a YoMama Joke String
- Return type
str
- await eight_ball() str [source]#
This function is a coroutine. Gets an 8ball response
- Return type
str
- await pickup_line() PickupLine [source]#
This function is a coroutine. Get a PickupLine
- Return type
- await typeracer() Typeracer [source]#
This function is a coroutine. Get a sentence on an image
- Return type
- await waifu() Dict[str, Any] [source]#
This function is a coroutine. Get a Random Anime Waifu. Does not return a model due to sheer complexity and impracticality.
- Return type
- await data_ping() float [source]#
This function is a coroutine. Returns a float with the Data API’s ping
- Returns
ping time for data api
- Return type
float
Danger
Closing the Client means a new one must be initialised otherwise there will be errors.