discord oauth2
Project description
sanic-discord
example
from sanic import Sanic
from sanic.response import text
from sanic_discord import Client, Config
app = Sanic("app")
client = Client(
Config(
secret="secret",
id="clientid",
login_url="login url",
callback_url="https://example.com/callback",
redirect_url="/me"
)
)
@app.route("/callback")
async def callback(request):
return await client.callback(request)
@app.route("/me")
@client.oauth2_required()
async def me(request, user):
return text(user["username"] + "hello")
app.run("0.0.0.0", 8000)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sanic-discord-1.0.0a2.tar.gz
(7.1 kB
view hashes)
Built Distribution
Close
Hashes for sanic_discord-1.0.0a2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a387fd38199f0d85fec370430eea529f1a72c2072a5abc5d6ec68dd2b08c72d9 |
|
MD5 | f759351319b6a33b3138330ecc50dbd5 |
|
BLAKE2b-256 | d4c708658294759f060796a9c871cc7c2eefc3da9b8912d25221880933d1c2bd |