<s> import requests <EOL> from allauth . socialaccount . providers . oauth2 . views import ( OAuth2Adapter , <EOL> OAuth2LoginView , <EOL> OAuth2CallbackView ) <EOL> from . client import UntappdOAuth2Client <EOL> from . provider import UntappdProvider <EOL> class UntappdOAuth2Adapter ( OAuth2Adapter ) : <EOL> provider_id = UntappdProvider . id <EOL> access_token_url = '<STR_LIT>' <EOL> access_token_method = '<STR_LIT:GET>' <EOL> authorize_url = '<STR_LIT>' <EOL> user_info_url = '<STR_LIT>' <EOL> supports_state = False <EOL> def complete_login ( self , request , app , token , ** kwargs ) : <EOL> resp = requests . get ( self . user_info_url , <EOL> params = { '<STR_LIT>' : token . token } ) <EOL> extra_data = resp . json ( ) <EOL> return self . get_provider ( ) . sociallogin_from_response ( request , <EOL> extra_data ) <EOL> class UntappdOAuth2CallbackView ( OAuth2CallbackView ) : <EOL> """<STR_LIT>""" <EOL> def get_client ( self , request , app ) : <EOL> client = super ( UntappdOAuth2CallbackView , self ) . get_client ( request , <EOL> app ) <EOL> untappd_client = UntappdOAuth2Client ( <EOL> client . request , client . consumer_key , client . consumer_secret , <EOL> client . access_token_method , client . access_token_url , <EOL> client . callback_url , client . scope ) <EOL> return untappd_client <EOL> oauth2_login = OAuth2LoginView . adapter_view ( UntappdOAuth2Adapter ) <EOL> oauth2_callback = UntappdOAuth2CallbackView . adapter_view ( UntappdOAuth2Adapter ) </s>
