<s> try : <EOL> from urllib . parse import parse_qsl <EOL> except ImportError : <EOL> from urlparse import parse_qsl <EOL> from django . core . urlresolvers import reverse <EOL> from django . utils . http import urlencode <EOL> from allauth . socialaccount . providers . base import Provider <EOL> class OAuth2Provider ( Provider ) : <EOL> def get_login_url ( self , request , ** kwargs ) : <EOL> url = reverse ( self . id + "<STR_LIT>" ) <EOL> if kwargs : <EOL> url = url + '<STR_LIT:?>' + urlencode ( kwargs ) <EOL> return url <EOL> def get_auth_params ( self , request , action ) : <EOL> settings = self . get_settings ( ) <EOL> ret = settings . get ( '<STR_LIT>' , { } ) <EOL> dynamic_auth_params = request . GET . get ( '<STR_LIT>' , None ) <EOL> if dynamic_auth_params : <EOL> ret . update ( dict ( parse_qsl ( dynamic_auth_params ) ) ) <EOL> return ret <EOL> def get_scope ( self , request ) : <EOL> settings = self . get_settings ( ) <EOL> scope = settings . get ( '<STR_LIT>' ) <EOL> if scope is None : <EOL> scope = self . get_default_scope ( ) <EOL> dynamic_scope = request . GET . get ( '<STR_LIT>' , None ) <EOL> if dynamic_scope : <EOL> scope . extend ( dynamic_scope . split ( '<STR_LIT:U+002C>' ) ) <EOL> return scope <EOL> def get_default_scope ( self ) : <EOL> return [ ] </s>
