Discord.Web
An asynchronous wrapper for the Discord Oauth2 API
Explore the docs »
Table of Contents
About The Project
Discord-Web is an easy way to interface with the Discord Oauth api. If you're new the realm of developing for discord, you may not know what the Oauth2 api may be used for. Well, a good example would be a Login backend on your bot's website to allow for some advanced dashboard creation. Creating these requests yourself can be time-consuming! Here's where Discord-Web comes into play. We handle the requests for you, returning easy to manage Python Objects such as the Oauth2Member object and the Oauth2Guild.
Built With
Getting Started
Welcome to the Getting Started Section. Here, we explain how you can get started with the discord-web library.
Prerequisites
Here's a list of prerequisites that you will need for the discord-web library to work. Keep in mind that all of these (with the exception of aiohttp[speedups]) are installed when installing discord.web
- discord.py
pip install discord.py
- aiohttp
pip install aiohttp
Installing the speedups for aiohttp
If you wish, you can install the speedups package for aiohttp, which allows aiohttp to run requests much faster.
- aiohttp speedups
pip install aiohttp[speedups]
Installation
Installing the discord.web library is a breeze. Here we list both ways of installing the library (the stable version and the development version)
pip install discord.web
pip install git+https://github.com/quiktea/discord.web/
Usage
First of all, you need to create an application on the Discord Developer Portal. Once you do that, click on the OAuth2 tab and follow the example below:
Initialising an OAuth2 Client
To initialise an OAuth2 Client, simply follow the example below:
from discord_web.oauth2 import Oauth2Client
client = Oauth2Client(client_id, "client_secret", "redirect_uri", ["scope1", "scope2"])
Generating an Access Token
To access a user's info, you need what's called an Access Token. To get an access token, you first need the code given to you by the OAuth2 login url that you created on the Discord Developer Portal. After a user logins in using your URL, they will be redirected to the redirect_uri that you provided on the Developer Portal. After getting redirected, the URL on your end will be returned with the code URL parameter, which looks like so: https://example.com/?code=CODE. You will need to access this code. In Django, you would access it like so: request.GET.get("code"). This is the code that you pass into the exchange_code function. The function will then return an AccessToken object which holds information such as the refresh_token and the access_token. To access the access token, simply reference the access_token property of your AccessToken class.
For more examples, please refer to the Documentation
Roadmap
See the open issues for a list of proposed features (and known issues).
Contributing
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
Distributed under the MIT License. See LICENSE for more information.
Contact
Discord - discord.web - https://discord.gg/JmhWrK99GS
Project Link: https://github.com/quiktea/discord.web
Acknowledgements
Metadata
Release files for discord.web 0.0.2
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 |
|---|---|---|---|---|
| discord.web-0.0.2.tar.gz | 6.9 kB | Without provenance | Details for discord.web-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| discord.web-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for discord.web-0.0.2-py3-none-any.whl |
Total release size: 14.9 kB
Release files / discord.web-0.0.2.tar.gz
| Download URL | discord.web-0.0.2.tar.gz |
|---|---|
| Size | 6.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1fcb235523312d5ff53d8a36e0674dfa75eba781007cfe745ff5a7c30442d7a9
|
|
BLAKE2b-256 checksum How to use checksums |
28d33003a473399b49510e287ec62a3861c7c8798ee22067af4d57b022e31a9e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/54.2.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7
|
Release files / discord.web-0.0.2-py3-none-any.whl
| Download URL | discord.web-0.0.2-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ca7c54e76f4069566adcc300638f61a8afc85fbc140346fedf3fa798dd523209
|
|
BLAKE2b-256 checksum How to use checksums |
bcfcbe73a675aeb2773e966de666f7ac7a23243fac6637a5ad25c6e1454567be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/54.2.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7
|
Security for discord.web 0.0.2
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.