GithubHelp home page GithubHelp logo

cryptex-github / asyncdagpi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from daggy1234/asyncdagpi

0.0 0.0 0.0 260 KB

An async wrapper for https://dagpi.xyz

Home Page: https://asyncdagpi.rtfd.io

License: MIT License

Python 100.00%

asyncdagpi's Introduction

asyncdagpi

Build Status License version python Documentation Status Codecov Codacy Badge

Powerful Asynchronous Wrapper for dagpi dagpi.xyz

Installation

pip install asyncdagpi

Data API

Some endpoints like WTP, PickupLine and Logo will return Objects while Waifu will return a Dictionary. Everything else will return a string.

from asyncdagpi import Client
dagpi = Client("dagpi token")
# For WTP Object
wtp = await dagpi.wtp()
#For Roast
roast = await dagpi.roast()

Image Manipulation

All Image endpoints return an Image object. This has many properties that can be useful for developers. For Basic implementations are displayed

Discord.py

from discord.ext import commands
import discord
from asyncdagpi import Client, ImageFeatures

bot = commands.Bot(command_prefix="!")
dagpi = Client("dagpi token")

@bot.command()
async def pixel(ctx, member: discord.Member):
    url = str(member.avatar_url_as(static_format="png", size=1024))
    img = await dagpi.image_process(ImageFeatures.pixel(), url)
    file = discord.File(fp=img.image,filename=f"pixel.{img.format}")

Writing To File

from asyncdagpi import Client, ImageFeatures
dagpi = Client("dagpi token")
img = await dagpi.image_process(ImageFeatures.pixel(), "https://dagbot-is.the-be.st/logo.png")
#it will auto chose the right format and write to current directory
img.write("pixel")
#will create pixel.png in this case

Python Pillow

from asyncdagpi import ImageFeatures, Client
from PIL import Image

dagpi = Client("dagpi token")
img = await dagpi.image_process(ImageFeatures.pixel(), "https://dagbot-is.the-be.st/logo.png")
im = Image.open(img.image)

Kwargs Example

from asyncdagpi import ImageFeatures, Client

dagpi = Client("dagpi token")
img = await dagpi.image_process(ImageFeatures.tweet(), "https://dagbot-is.the-be.st/logo.png", text="This is asyncdagpi tweeting live from dagpi.xyz!", username="Asyncdagpi")

For More Thorough Examples and Feature list read the documentation

Docs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.