API Reference

The following section states all of the classes and methods directly available to end users.

Client

class image_processor_client.Client[source]

Main client class for end users establishing connection to Image Processor API Server providing all of the categorised Image Methods.

Parameters:
  • connection_url (str, optional) – Base URL to running Image Processor API server. If not specified, attempts to connect to local Image Processor API or developer’s server if available.
  • loop – The event loop to use for asynchronous operations. Uses asyncio.get_event_loop() if not specified.
memes

An instance of MemesMethods class providing all of the available methods for memes category.

Type:image_processor_client.image_methods.MemesMethods
discord

An instance of DiscordMethods class providing all of the available methods for discord category.

Type:image_processor_client.image_methods.DiscordMethods
utils

An instance of ImageUtils providing common utility methods for images.

Type:image_processor_client.utils.ImageUtils
close()[source]

Closes running aiohttp session and performs basic cleanup.

Image Methods

class image_processor_client.image_methods.MemesMethods[source]

Base class for available memes processing methods.

rip(text: str, avatar_url: str) → bytes[source]

Requests server to process RIP meme using provided parameters and returns image bytes.

Parameters:
  • text (str) – The text to write below avatar of RIP person.
  • avatar_url (str) – Direct link to avatar to be shown in RIP Meme.
Returns:

Binary image bytes.

Return type:

bytes

class image_processor_client.image_methods.DiscordMethods[source]

Base class for available discord imaging methods.

get_profile_rank_card(**kwargs)[source]

Requests to generate member’s rank card bounded to every discord guild.

Parameters:
  • name (str) – Discord name of the member. Without discriminator.
  • discriminator (str) – Discord discriminator of the member.
  • avatar_url (str) – Direct link to member’s avatar URL.
  • text_rank (int) – Member’s text rank in the guild.
  • voice_rank (int) – Member’s voice rank in the guild.
  • text_xp (int) – Member’s text xp.
  • text_target_xp (int) – The xp needed for the next level.
  • text_total_xp (int) – Total text xp of the member.
  • text_level (int) – Text chat level of the member.
  • voice_xp (int) – Member’s voice xp.
  • voice_target_xp (int) – The xp needed for next voice level.
  • voice_total_xp (int) – Total voice xp of the member.
  • voice_level (int) – Voice level of the member.
Returns:

Binary image bytes of generated rank card of the member.

Return type:

bytes

Raises:

KeyError – Raise KeyError when any of the required data key is not present.

get_welcome_banner(banner_url: str, avatar_url: str, name: str, discriminator: int, text: str, **options)[source]

Requests for welcome banner mostly used by discord servers to welcome newly joined members with custom text.

Note

It supports most of the image formats including GIFs.

Parameters:
  • banner_url (str) – Direct URL of the banner file to be used as template. It can also be a GIF.
  • avatar_url (str) – Direct URL of member’s avatar to be pasted on banner.
  • name (str) – Discord name of new member or anything.
  • discriminator (int) – The discriminator of the Discord user.
  • text (str) – Custom text to be written after name.
  • border_color (str, optional) – Specify banner border color.
  • font_color (str, optional) – Specify font color for banner text.
  • avatar_border_color (str, optional) – Specify border color for avatar.
Returns:

Binary image bytes of banner. It can also be a GIF.

Return type:

bytes

ss_message(name: str, message_content: str, avatar_url: str, name_color: tuple = None, time_stamp: str = None)[source]

Requests server to process screenshot of a discord message using provided parameters and returns image bytes.

Note

For now it only supports text message content.

Parameters:
  • name (str) – Name of discord User or Member who sent the message.
  • message_content (str) – Full clean message content
  • avatar_url (str) – Direct avatar URL of discord User or Member who sent the message.
  • name_color (tuple, optional) – A tuple representing RGB color of discord User or Message who sent the message. It’s default value is set to (255, 255, 255).
  • time_stamp (str, optional) – String representing date and time stamp of epoch when message was sent. Uses Today at 11:38 AM if not provided.
Returns:

Binary image bytes which appears as screenshot of a discord message.

Return type:

bytes

Utilities

class image_processor_client.utils.ImageUtils[source]

A common utility class containing methods to fetch details or something of image.

fetch_size(url: str)[source]

Returns total size of content from provided URL querying Content-Length from HTTP headers.

Parameters:url (str) – Direct URL to the content to get size of.
Returns:An integer representing total size of content in bytes.
Return type:int