Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 196d577

Browse files
Merge pull request #8 from Paillat-dev/main
Add async library support
2 parents 3b44626 + 8064304 commit 196d577

File tree

8 files changed

+950
-323
lines changed

8 files changed

+950
-323
lines changed

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
main.py
22
rewrite.py
33
discordoauth2/__pycache__
4+
.idea/

‎README.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ I've finally published the library to PyPi! So now you can use pip.
1212
```
1313
pip install discord-oauth2.py
1414
```
15+
1516
### Example With Flask
1617
Don't forget to replace all the client information with your application's own information. You can leave bot token empty if your not adding members to guilds.
1718
```py
@@ -57,3 +58,6 @@ def oauth2():
5758

5859
app.run("0.0.0.0", 8080)
5960
```
61+
62+
### Async usage
63+
Asynchronous usage is also supported, you can use the async version of the library by importing `discordoauth2.AsyncClient` instead of `discordoauth2.Client`. The methods are the same, but they’re coroutines.

‎discordoauth2/__init__.py‎

Lines changed: 14 additions & 296 deletions
Large diffs are not rendered by default.

‎discordoauth2/async_oauth.py‎

Lines changed: 453 additions & 0 deletions
Large diffs are not rendered by default.

‎discordoauth2/exceptions.py‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
class Exceptions:
2+
class BaseException(Exception):
3+
pass
4+
5+
class HTTPException(BaseException):
6+
pass
7+
8+
class RateLimited(HTTPException):
9+
def __init__(self, text, retry_after):
10+
self.retry_after = retry_after
11+
super().__init__(text)
12+
13+
class Forbidden(HTTPException):
14+
pass
15+
16+
17+
# Alias for compatibility with the old version, but class names should follow the CapitalizedWords convention
18+
exceptions = Exceptions

‎discordoauth2/sync_oauth.py‎

Lines changed: 434 additions & 0 deletions
Large diffs are not rendered by default.

‎docs/source/conf.py‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,34 @@
22

33
# -- Project information
44

5-
project = 'discordoauth2.py'
6-
copyright = '2022, TreeBen77'
7-
author = 'TreeBen77'
5+
project = "discordoauth2.py"
6+
copyright = "2022, TreeBen77"
7+
author = "TreeBen77"
88

9-
release = '1.1'
10-
version = '1.1.1'
9+
release = "1.1"
10+
version = "1.1.1"
1111

1212
# -- General configuration
1313

1414
extensions = [
15-
'sphinx.ext.duration',
16-
'sphinx.ext.doctest',
17-
'sphinx.ext.autodoc',
18-
'sphinx.ext.autosummary',
19-
'sphinx.ext.intersphinx',
15+
"sphinx.ext.duration",
16+
"sphinx.ext.doctest",
17+
"sphinx.ext.autodoc",
18+
"sphinx.ext.autosummary",
19+
"sphinx.ext.intersphinx",
2020
]
2121

2222
intersphinx_mapping = {
23-
'python': ('https://docs.python.org/3/', None),
24-
'sphinx': ('https://www.sphinx-doc.org/en/master/', None),
23+
"python": ("https://docs.python.org/3/", None),
24+
"sphinx": ("https://www.sphinx-doc.org/en/master/", None),
2525
}
26-
intersphinx_disabled_domains = ['std']
26+
intersphinx_disabled_domains = ["std"]
2727

28-
templates_path = ['_templates']
28+
templates_path = ["_templates"]
2929

3030
# -- Options for HTML output
3131

32-
html_theme = 'sphinx_rtd_theme'
32+
html_theme = "sphinx_rtd_theme"
3333

3434
# -- Options for EPUB output
35-
epub_show_urls = 'footnote'
35+
epub_show_urls = "footnote"

‎setup.py‎

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,19 @@
44
long_description = file.read()
55

66
setup(
7-
name='discord-oauth2.py',
8-
description='Use Discord\'s OAuth2 effortlessly! Turns the auth code to a access token and the access token into scope infomation. ',
7+
name="discord-oauth2.py",
8+
description="Use Discord's OAuth2 effortlessly! Turns the auth code to a access token and the access token into scope infomation. ",
99
version="1.2.1",
1010
long_description=long_description,
1111
long_description_content_type="text/markdown",
12-
license='MIT',
13-
python_requires='>=3.8',
12+
license="MIT",
13+
python_requires=">=3.8",
1414
author="TreeBen77",
15-
packages=[
16-
'discordoauth2'
17-
],
18-
url='https://github.com/TreeBen77/discordoauth2',
19-
keywords='flask, oauth2, discord, discord-api',
15+
packages=["discordoauth2"],
16+
url="https://github.com/TreeBen77/discordoauth2",
17+
keywords="flask, oauth2, discord, discord-api",
2018
install_requires=[
21-
'requests'
22-
]
19+
"aiohttp",
20+
"requests",
21+
],
2322
)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /