Skip to main content

A library for interactions.py allowing runtime API structures

Project description

interactions restful

A library for interactions.py allowing runtime API structures

Installation

Using pip:
pip install interactions-restful

Using poetry:
poetry add interactions-restful

Don't forget to specify backend you want to use:

  • flask pip install interactions-restful[flask]
  • fastapi pip install interactions-restful[fastapi]

Simple example

Main file

import interactions
from interactions_restful import setup
from interactions_restful.backends.fast_api import FastAPI

client = interactions.Client()

setup(client, FastAPI, "127.0.0.1", 5000)

client.load_extension("api")

client.start("token")

Extension file

  • api.py
import interactions
from interactions_restful import route


class MyAPI(interactions.Extension):
    @route("GET", "/")
    def index(self):
        return {"status": "Hello, i.py"}
    
    @interactions.slash_command()
    async def test_command(self, ctx):
        await ctx.send("Hello, API")

Backends

Currently, library support only flask and fastapi as a backend for building an api, but if you don't want to use them you can create own backend.

Documentation

FastAPI documentation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

interactions-restful-1.0.2.tar.gz (16.5 kB view hashes)

Uploaded Source

Built Distribution

interactions_restful-1.0.2-py3-none-any.whl (17.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page