An asynchronous discord OAuth2 API wrapper.
Project description
Discord OAuth2
A modern, easy to use discord OAuth2 API wrapper written in Python.
Installing
Python >3.8 is required.
You can run the following command to install the library:
$ pip install disco.oauth2
To install the development version (lastest), do the following:
$ pip install git+https://github.com/InviteManagerBot/disco.oauth2.git
Getting started
Quick Example
from disco_oauth2 import Client
client = Client(
client_id=client_id_here,
client_secret="client_secret_here",
redirect_uri="redirect_uri_here",
scopes=["identify", "guilds", "email", "connections"],
)
async def main():
# Exchange a code received from the callback from the redirect url.
access_token = await client.exchange_code("my_code")
# Fetch user's information with access token.
user = await client.fetch_user(access_token)
# Fetch user's connections.
connections = await user.fetch_connections()
# Fetch guilds that the user is member of.
guilds = await user.fetch_guilds()
print(f"{user!r} | {connections!r}")
for guild in guilds:
print(f"`{user.name}` member of {guild!r}")
Requirements
- aiohttp > = 3.7.4, < 4
Optionally you may install the orjson
libraries (highly recommended for sake of speed).
License
discord_oauth2
was written by martimartins martim13artins13@gmail.com, licensed under the MIT license.
Contributing
All contributions are welcome ;)
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
disco.oauth2-1.2a0.tar.gz
(18.3 kB
view hashes)
Built Distribution
Close
Hashes for disco.oauth2-1.2a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d60373a3f87fdf8741290ba1c1b536139217f312ec33cb223f0dd142dfc885b6 |
|
MD5 | c5c6d61ddd9473982820781034f36007 |
|
BLAKE2b-256 | fe669ebdcdb60262adb565ec6a0d085cf4fd31142e3d3b50ffb7625e430bc024 |