discordwebhook.py
A python package for using Discord Oauth2 with any webserver. Designed to be simple to use with as little input as possible. Asynchronous webservers (eg Quart) are reccomended
For downloads see the PyPi page For documentation see the /docs directory. For extra support join the Discord server
Installation
pip install discordoauth.py
Examples
See Examples in the examples/ directory
Quart example
"""
Basic Quart example for using Discord Oauth2
"""
import quart
import discordoauth
app = quart.Quart(__name__)
# The application ID and secret to use for Oauth.
app_id = 999999999999999999
app_secret = "app_secret_here"
# Initialise client and choose scopes.
# Supported scopes can be seen in the README.md
client = discordoauth.Client(app_id, app_secret)
scopes = discordoauth.Scopes(identify=True)
# The address that flask is currently running on
address = "localhost:5000"
@app.route("/login", ["GET"])
def _login():
# Generate an oauth URL and redirect the user to it
return quart.redirect(
client.get_oauth_url(scopes, rediret_uri= address+"/return")
)
@app.route("/return", ["GET"])
async def _discord_return():
# Get the code discord responds with from URI arguments
code = quart.request.args.get("code")
# Start a session
session = client.new_session(code, scopes, address+"/return")
# Use scope identify to fetch user information. Automatically converts code to access token
user = await session.fetch_user()
return f"""
Username: {user.name} <br>
User ID: {user.id}
"""
# Run the app locally on port 5000
app.run("0.0.0.0", 5000)
Metadata
Release files for discordoauth.py 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| discordoauth.py-0.1.3.tar.gz | 8.4 kB | Without provenance | Details for discordoauth.py-0.1.3.tar.gz |
Release files / discordoauth.py-0.1.3.tar.gz
| Download URL | discordoauth.py-0.1.3.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f5d1f560f53d344f96c5aceb960fa42cfbc0dffdc86cf3a8dcea09e22e3d01e8
|
|
BLAKE2b-256 checksum How to use checksums |
24c8b95ae0acfe0677381127ac56bd9f52971a6bb1c2eeeecd082f8f5d9546cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1
|
Security for discordoauth.py 0.1.3
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.