Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/invalidlenni/quart-nextcord
Discord OAuth2 extension for Quart. An Easier implementation of "Log In With Discord". Maintained Fork of Quart-Discord.
https://github.com/invalidlenni/quart-nextcord
aiohttp discord discord-bot discordpy flask nextcord python python3 quart
Last synced: 17 days ago
JSON representation
Discord OAuth2 extension for Quart. An Easier implementation of "Log In With Discord". Maintained Fork of Quart-Discord.
- Host: GitHub
- URL: https://github.com/invalidlenni/quart-nextcord
- Owner: InvalidLenni
- License: mit
- Created: 2022-05-30T14:47:40.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-08T11:42:47.000Z (over 1 year ago)
- Last Synced: 2024-10-16T03:28:17.549Z (24 days ago)
- Topics: aiohttp, discord, discord-bot, discordpy, flask, nextcord, python, python3, quart
- Language: Python
- Homepage: https://quart-nextcord.rtfd.io/
- Size: 2.09 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Quart-Nextcord
[![PyPI](https://img.shields.io/pypi/v/Quart-Nextcord?style=for-the-badge)](https://pypi.org/project/Quart-Nextcord/) [![Read the Docs](https://img.shields.io/readthedocs/quart-nextcord?style=for-the-badge)](https://quart-nextcord.readthedocs.io/en/latest/)Discord OAuth2 extension for Quart.
# NO SUPPORT & UPDATES
```md
[!] This library will not get any updates in the future. [!]
```### Installation
To install current latest release you can use following command:
```sh
python3 -m pip install Quart-Nextcord
```
To install the current dev version you can use followering command:
```sh
python3 - m pip install git+https://github.com/InvalidLenni/Quart-Nextcord/tree/dev
```### Basic Example
```python
from quart import Quart, redirect, url_for
from quart_nextcord import DiscordOAuth2Session, requires_authorization, Unauthorizedapp = 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.nextcord = DiscordOAuth2Session(app)
@app.route("/login/")
async def login():
return await nextcord.create_session()@app.route("/callback/")
async def callback():
await nextcord.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 nextcord.fetch_user()
return f"""
{user.name}
"""if __name__ == "__main__":
app.run()
```For an example to the working application, check [`test_app.py`](tests/test_app.py)
### Requirements
* Quart
* Async-OAuthlib
* cachetools
* nextcord### Documentation
Head over to [documentation] for full API reference.[documentation]: https://quart-nextcord.readthedocs.io/en/latest/