Skip to main content

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:

  • FastAPI: pip install interactions-restful[fastapi]
  • Quart: pip install interactions-restful[quart]

Also make sure to install an ASGI server:

  • Uvicorn: pip install interactions-restful[uvicorn]
  • Hypercorn: pip install interactions-restful[hypercorn]
  • Daphne: pip install interactions-restful[daphne]

You can also install both your backend and ASGI server at once, for example pip install interactions-restful[fastapi,uvicorn]

Simple (FastAPI) example

Main file

  • main.py
import interactions
from fastapi import FastAPI
from interactions_restful.backends.fastapi import FastAPIHandler

app = FastAPI()

client = interactions.Client(token="token")
FastAPIHandler(client, app)

client.load_extension("api")

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")

Run

uvicorn main:app --reload

Backends

Currently, the library support only Quart and FastAPI as a backend for building an API, but if you don't want to use them you can create own backend.

Release files for interactions-restful 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for interactions-restful 2.0.0
File Size Uploaded
interactions-restful-2.0.0.tar.gz 17.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for interactions-restful 2.0.0
File Interpreter ABI Platform
interactions_restful-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 36.9 kB

Release files / interactions-restful-2.0.0.tar.gz

Download URL interactions-restful-2.0.0.tar.gz
Size 17.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2dee6048418853ec39594ec371f124cacf59a8a84ccf98f3a2e080e910e0d85a
BLAKE2b-256 checksum
How to use checksums
d4f10134b8e107835b31592a7579f1b5af678d8e0d442fea00732d013d5a013f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17

Release files / interactions_restful-2.0.0-py3-none-any.whl

Download URL interactions_restful-2.0.0-py3-none-any.whl
Size 18.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2345216763931725f8be81eba8bf5a7f6b8f9e1dd0d10f42947a561d9ff4e7f4
BLAKE2b-256 checksum
How to use checksums
3e2dae71cb4d3fa219dacba5f7f3c5d10cc1002f3d2223d0fe6a9ae9c3c834d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page