-
-
Notifications
You must be signed in to change notification settings - Fork 546
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into refactoring/improve-vk-api
- Loading branch information
Showing
107 changed files
with
486 additions
and
334 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.0.1 | ||
hooks: | ||
- id: check-merge-conflict | ||
- id: check-json | ||
- id: debug-statements | ||
- id: mixed-line-ending | ||
args: [--fix=lf] | ||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v2.29.1 | ||
hooks: | ||
- id: pyupgrade | ||
args: [--py36-plus] | ||
- repo: meta | ||
hooks: | ||
- id: check-hooks-apply | ||
- id: check-useless-excludes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
""" | ||
Discord Auth OAuth2 backend, docs at: | ||
https://discord.com/developers/docs/topics/oauth2 | ||
""" | ||
from .oauth import BaseOAuth2 | ||
|
||
|
||
class DiscordOAuth2(BaseOAuth2): | ||
name = 'discord' | ||
HOSTNAME = 'discord.com' | ||
AUTHORIZATION_URL = 'https://%s/api/oauth2/authorize' % HOSTNAME | ||
ACCESS_TOKEN_URL = 'https://%s/api/oauth2/token' % HOSTNAME | ||
ACCESS_TOKEN_METHOD = 'POST' | ||
REVOKE_TOKEN_URL = 'https://%s/api/oauth2/token/revoke' % HOSTNAME | ||
REVOKE_TOKEN_METHOD = 'GET' | ||
DEFAULT_SCOPE = ['identify'] | ||
SCOPE_SEPARATOR = '+' | ||
REDIRECT_STATE = False | ||
EXTRA_DATA = [ | ||
('expires_in', 'expires'), | ||
('refresh_token', 'refresh_token') | ||
] | ||
|
||
def get_user_details(self, response): | ||
return {'username': response.get('username'), | ||
'email': response.get('email') or ''} | ||
|
||
def user_data(self, access_token, *args, **kwargs): | ||
url = 'https://%s/api/users/@me' % self.HOSTNAME | ||
auth_header = {'Authorization': 'Bearer %s' % access_token} | ||
return self.get_json(url, headers=auth_header) | ||
""" | ||
Discord Auth OAuth2 backend, docs at: | ||
https://discord.com/developers/docs/topics/oauth2 | ||
""" | ||
from .oauth import BaseOAuth2 | ||
|
||
|
||
class DiscordOAuth2(BaseOAuth2): | ||
name = 'discord' | ||
HOSTNAME = 'discord.com' | ||
AUTHORIZATION_URL = 'https://%s/api/oauth2/authorize' % HOSTNAME | ||
ACCESS_TOKEN_URL = 'https://%s/api/oauth2/token' % HOSTNAME | ||
ACCESS_TOKEN_METHOD = 'POST' | ||
REVOKE_TOKEN_URL = 'https://%s/api/oauth2/token/revoke' % HOSTNAME | ||
REVOKE_TOKEN_METHOD = 'GET' | ||
DEFAULT_SCOPE = ['identify'] | ||
SCOPE_SEPARATOR = '+' | ||
REDIRECT_STATE = False | ||
EXTRA_DATA = [ | ||
('expires_in', 'expires'), | ||
('refresh_token', 'refresh_token') | ||
] | ||
|
||
def get_user_details(self, response): | ||
return {'username': response.get('username'), | ||
'email': response.get('email') or ''} | ||
|
||
def user_data(self, access_token, *args, **kwargs): | ||
url = 'https://%s/api/users/@me' % self.HOSTNAME | ||
auth_header = {'Authorization': 'Bearer %s' % access_token} | ||
return self.get_json(url, headers=auth_header) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,7 +45,7 @@ def get_user_id(self, details, response): | |
'email': '[email protected]' | ||
} | ||
""" | ||
return '{0}'.format(details.get('id')) | ||
return '{}'.format(details.get('id')) | ||
|
||
def uses_redirect(self): | ||
return False | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.