/usr/lib/python3/dist-packages/social/backends/battlenet.py is in python3-social-auth 1:0.2.21+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | from social.backends.oauth import BaseOAuth2
# This provides a backend for python-social-auth. This should not be confused
# with officially battle.net offerings. This piece of code is not officially
# affiliated with Blizzard Entertainment, copyrights to their respective
# owners. See http://us.battle.net/en/forum/topic/13979588015 for more details.
class BattleNetOAuth2(BaseOAuth2):
""" battle.net Oauth2 backend"""
name = 'battlenet-oauth2'
ID_KEY = 'accountId'
REDIRECT_STATE = False
AUTHORIZATION_URL = 'https://eu.battle.net/oauth/authorize'
ACCESS_TOKEN_URL = 'https://eu.battle.net/oauth/token'
ACCESS_TOKEN_METHOD = 'POST'
REVOKE_TOKEN_METHOD = 'GET'
DEFAULT_SCOPE = ['wow.profile']
EXTRA_DATA = [
('refresh_token', 'refresh_token', True),
('expires_in', 'expires'),
('token_type', 'token_type', True)
]
def get_characters(self, access_token):
"""
Fetches the character list from the battle.net API. Returns list of
characters or empty list if the request fails.
"""
params = {'access_token': access_token}
if self.setting('API_LOCALE'):
params['locale'] = self.setting('API_LOCALE')
response = self.get_json(
'https://eu.api.battle.net/wow/user/characters',
params=params
)
return response.get('characters') or []
def get_user_details(self, response):
""" Return user details from Battle.net account """
return {'battletag': response.get('battletag')}
def user_data(self, access_token, *args, **kwargs):
""" Loads user data from service """
return self.get_json(
'https://eu.api.battle.net/account/user',
params={'access_token': access_token}
)
|