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[aiohttp.client.ClientSession] = None, loop: Optional[asyncio.events.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: asyncdagpi.objects.Ratelimits

Get ratelimits for your client

await image_process(feature: asyncdagpi.image_features.ImageFeatures, url: str, **kwargs: Any) asyncdagpi.image.Image[source]

This function is a coroutine.

Parameters
  • feature (ImageFeature) – a dagpi ImageFeature class

  • url (str) – the Url for the Image Passed

  • kwargs – based on the Docs for your Feature chose the right extra kwargs like text or username

Returns

Asyncdagpi Image Object

Return type

asyncdagpi.Image

await special_image_process(url: str) asyncdagpi.image.Image[source]

This function is a coroutine.

Parameters

url (str) – the Url for the Image Passed

Returns

Asyncdagpi Image Object

Return type

asyncdagpi.Image

await wtp() asyncdagpi.objects.WTP[source]

get a WTP data object :returns: asyncdagpi.WTP

This function is a coroutine. get a Logo data object

Returns

logo object

Return type

asyncdagpi.Logo

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 joke() str[source]

This function is a coroutine. Gets a Funny Joke

Return type

str

await fact() str[source]

This function is a coroutine. Gets a Fun fact

Return type

str

await eight_ball() str[source]

This function is a coroutine. Gets an 8ball response

Return type

str

await pickup_line() asyncdagpi.objects.PickupLine[source]

This function is a coroutine. Get a PickupLine

Return type

asyncdagpi.objects.PickupLine

await headline() asyncdagpi.objects.Headline[source]

This function is a coroutine. Get a Headline

Return type

asyncdagpi.objects.Headline

await captcha() asyncdagpi.objects.Captcha[source]

This function is a coroutine.

Get a captcha

Return type

asyncdagpi.objects.Captcha

await typeracer() asyncdagpi.objects.Typeracer[source]

This function is a coroutine. Get a sentence on an image

Return type

asyncdagpi.objects.Typeracer

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

asyncdagpi.objects.PickupLine

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

await image_ping() float[source]

This function is a coroutine. Returns a float with the Image API’s ping

Returns

ping time for image api

Return type

float

await close() None[source]

This function is a coroutine. Shuts down the asyncdagpi Client

Danger

Closing the Client means a new one must be initialised otherwise there will be errors.