Coder Social home page Coder Social logo

yarsaw's Introduction

YARSAW

API Coverage PyPI - Downloads PyPI - License Documentation Status



YARSAW (Yet Another Random Stuff API Wrapper) is an Async, Object Oriented and Modern Python API Wrapper for the Random Stuff API. This module makes it simpler for you to interact with the API and is easy to implement into your application.

Make sure to get Random Stuff API Key from here and a RapidAPI Application Key after registering and subscribing to the API here.

Features

  • Tons of things you can do
    1. Get AI Responses (useful for chatbots!)
    2. Get Anime GIFs and Waifu Images
    3. Get Animal images
    4. Get memes from various subreddits, and even create memes with pre-built templates!
    5. Get jokes and fun facts
    6. And so much more!
  • Object-oriented design. YARSAW takes inspiration from randomstuff.py and sends you the data from the API in form of objects instead of plain JSON.
  • Async-ready. YARSAW provides an async client for async enviorments using aiohttp.
  • Easy to use. YARSAW is well-documented, and has utility features to help you with your requests.
  • Saves your time. i) No need to learn about the API itself and its complicated design. ii) No need to enter the credentials again and again. Enter it once, and get coding. YARSAW will take care of the boring stuff for you. iii) No need to handle the unhelpful errors given by requests/aiohttp/RapidAPI. Get human-headable, descriptive and helpful error messages. iv) Common errors and issues are prevented and declared before runtime.

Examples

import yarsaw
import asyncio
client = yarsaw.Client("RSA Key", "RapidAPI Key")
async def joke():
   joke = await client.get_joke() # get the joke
   formatted_joke = yarsaw.format_joke(joke) # format the joke (optional)
   print(formatted_joke) # print the joke
asyncio.get_event_loop().run_until_complete(joke()) # run the joke() function

Installation

python3 -m pip install -U yarsaw

Useful Links

yarsaw's People

Contributors

27saumya avatar brucecodesgithub avatar deepsource-autofix[bot] avatar deepsourcebot avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

yarsaw's Issues

AIResponse giving wrong age

Bot replies with correct birth year but not the correct age
Code:

class AI(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.client = yarsaw.Client("RSA_TOKEN", "RAPID_API_TOKEN")

    @commands.Cog.listener()
    async def on_message(self, msg):
        if msg.author == self.bot.user:
          return
        
        elif msg.channel.id != 934805002499788852:
          return

        resp = await self.client.get_ai_response(message=msg.content, id=str(msg.author.id), bot_name="Chika-chan", bot_gender="female", bot_age="15", bot_birth_year=2006, bot_master="TheUnknown")

        resp = resp.AIResponse+ (" nya-" if random.randint(1,3)==1 else "")
        
        await msg.reply(resp)

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.