Skip to main content

quartcord

PyPI Build Documentation Status

Table of Contents

About

Discord OAuth2 extension for Quart.

Installation

Requirements

  • Quart
  • pyjwt
  • aiohttp
  • oauthlib
  • discord.py
  • cachetools
  • Async-OAuthlib

Setup

To install current latest release you can use following command:

python -m pip install quartcord

Basic Example

from quart import Quart, redirect, url_for
from quartcord import DiscordOAuth2Session, requires_authorization, Unauthorized

app = Quart(__name__)

app.secret_key = b"random bytes representing quart secret key"

app.config["DISCORD_CLIENT_ID"] = 490732332240863233  # Discord client ID.
app.config["DISCORD_CLIENT_SECRET"] = ""  # Discord client secret.
app.config["DISCORD_REDIRECT_URI"] = ""  # URL to your callback endpoint.
app.config["DISCORD_BOT_TOKEN"] = ""  # Required to access BOT resources.

discord = DiscordOAuth2Session(app)


@app.route("/login/")
async def login():
    return await discord.create_session()


@app.route("/callback/")
async def callback():
    await discord.callback()
    return redirect(url_for(".me"))


@app.errorhandler(Unauthorized)
async def redirect_unauthorized(e):
    return redirect(url_for("login"))


@app.route("/me/")
@requires_authorization
async def me():
    user = await discord.fetch_user()
    return f"""
    <html>
        <head>
            <title>{user.name}</title>
        </head>
        <body>
            <img src='{user.avatar_url}' />
        </body>
    </html>"""


if __name__ == "__main__":
    app.run()

Documentation

Head over to documentation for full API reference.

Support

Credits

License

MIT License

Copyright © 2023 Sayan "Sn1F3rt" Bhattacharyya

Metadata

Release files for quartcord 1.0.1

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

Source distribution (sdist)

Source distribution for quartcord 1.0.1
File Size Uploaded Provenance Actions
quartcord-1.0.1.tar.gz 15.3 kB Without provenance Details for quartcord-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for quartcord 1.0.1
File Interpreter ABI Platform Actions
quartcord-1.0.1-py3-none-any.whl Python 3 none any Details for quartcord-1.0.1-py3-none-any.whl

Total release size: 33.9 kB

Release files / quartcord-1.0.1.tar.gz

Download URL quartcord-1.0.1.tar.gz
Size 15.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c2fad39481a7ed072e5bab025f4d5f60ae08b3739022f2ae35f0702b73b7cf47
BLAKE2b-256 checksum
How to use checksums
0c6a4151ae72fb8e23e894e1a57f9ac90ee7935ad57e60231bab17e8f5a7363f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Release files / quartcord-1.0.1-py3-none-any.whl

Download URL quartcord-1.0.1-py3-none-any.whl
Size 18.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
239fe5655da20a75ab2cf823b6646be9b4537a652b665aabcf412ac3c2129089
BLAKE2b-256 checksum
How to use checksums
2ccaf08db10557e9991923c2eb67183b91b4d47bf2daf6558fe50463dfe9e200
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Security for quartcord 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

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