Skip to main content

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 -U https://github.com/InviteManagerBot/disco.oauth2

Getting started

Quick Example

from disco_oauth2 import Client

client = Client(
    client_id=my_client_id_here,
    client_secret="client_secret_here",
    redirect_uri="redirect_uri_here",
    scopes=["identify", "guilds", "email", "connections"],
)


async def main():
    # Exchange a code that I received from callback to 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


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.0a0.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

disco.oauth2-1.0a0-py3-none-any.whl (24.4 kB view details)

Uploaded Python 3

File details

Details for the file disco.oauth2-1.0a0.tar.gz.

File metadata

  • Download URL: disco.oauth2-1.0a0.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for disco.oauth2-1.0a0.tar.gz
Algorithm Hash digest
SHA256 ac9b50b9095b05a6a42b70fa4fd3aaea32d86b5a50b3e0ebc71d521dbb3d6da6
MD5 af6531ab5cf6aaed62f065aa0b82dda9
BLAKE2b-256 08fae86612194206bca9f790abd9190b99226e35c0d4ffb5c1262dc6f14dc1f3

See more details on using hashes here.

Provenance

File details

Details for the file disco.oauth2-1.0a0-py3-none-any.whl.

File metadata

  • Download URL: disco.oauth2-1.0a0-py3-none-any.whl
  • Upload date:
  • Size: 24.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for disco.oauth2-1.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 6e2e5153e208d4b6eae6b163f78017f9272ed8869aaf2da2f8b7d466af970958
MD5 ffb1d7eb25178fd37a4226622f5ea730
BLAKE2b-256 bf014365c5805d51286cb97901dc35fbbf27ff8d9d527db7981bd35c89b95299

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page