Code Monkey home page Code Monkey logo

disco.oauth2's Introduction

Discord OAuth2

Documentation Status Pypi version PyPi downloads Code style: Black

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 [email protected], licensed under the MIT license.

Contributing

All contributions are welcome ;)

disco.oauth2's People

Contributors

martimartins avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

felixbucket

disco.oauth2's Issues

help with access token

so in your code it says we have to enter a code to avail the access token:

access_token = await client.exchange_code("my_code")

but i am new to whole oauth2 stuff so do you mind telling me what should i enter as 'my code'?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.