<s> """<STR_LIT>""" <EOL> from social . p3 import urlsplit <EOL> from social . backends . open_id import OpenIdAuth <EOL> from social . backends . oauth import BaseOAuth2 <EOL> class YandexOpenId ( OpenIdAuth ) : <EOL> """<STR_LIT>""" <EOL> name = '<STR_LIT>' <EOL> URL = '<STR_LIT>' <EOL> def get_user_id ( self , details , response ) : <EOL> return details [ '<STR_LIT:email>' ] or response . identity_url <EOL> def get_user_details ( self , response ) : <EOL> """<STR_LIT>""" <EOL> values = super ( YandexOpenId , self ) . get_user_details ( response ) <EOL> values [ '<STR_LIT:username>' ] = values . get ( '<STR_LIT:username>' ) or urlsplit ( response . identity_url ) . path . strip ( '<STR_LIT:/>' ) <EOL> values [ '<STR_LIT:email>' ] = values . get ( '<STR_LIT:email>' , '<STR_LIT>' ) <EOL> return values <EOL> class YandexOAuth2 ( BaseOAuth2 ) : <EOL> """<STR_LIT>""" <EOL> name = '<STR_LIT>' <EOL> AUTHORIZATION_URL = '<STR_LIT>' <EOL> ACCESS_TOKEN_URL = '<STR_LIT>' <EOL> ACCESS_TOKEN_METHOD = '<STR_LIT:POST>' <EOL> REDIRECT_STATE = False <EOL> def get_user_details ( self , response ) : <EOL> fullname , first_name , last_name = self . get_user_names ( <EOL> response . get ( '<STR_LIT>' ) or response . get ( '<STR_LIT>' ) or '<STR_LIT>' <EOL> ) <EOL> return { '<STR_LIT:username>' : response . get ( '<STR_LIT>' ) , <EOL> '<STR_LIT:email>' : response . get ( '<STR_LIT>' ) or <EOL> response . get ( '<STR_LIT>' , [ '<STR_LIT>' ] ) [ <NUM_LIT:0> ] , <EOL> '<STR_LIT>' : fullname , <EOL> '<STR_LIT>' : first_name , <EOL> '<STR_LIT>' : last_name } <EOL> def user_data ( self , access_token , * args , ** kwargs ) : <EOL> return self . get_json ( '<STR_LIT>' , <EOL> params = { '<STR_LIT>' : access_token , <EOL> '<STR_LIT>' : '<STR_LIT>' } ) <EOL> class YaruOAuth2 ( BaseOAuth2 ) : <EOL> name = '<STR_LIT>' <EOL> AUTHORIZATION_URL = '<STR_LIT>' <EOL> ACCESS_TOKEN_URL = '<STR_LIT>' <EOL> ACCESS_TOKEN_METHOD = '<STR_LIT:POST>' <EOL> REDIRECT_STATE = False <EOL> def get_user_details ( self , response ) : <EOL> fullname , first_name , last_name = self . get_user_names ( <EOL> response . get ( '<STR_LIT>' ) or response . get ( '<STR_LIT>' ) or '<STR_LIT>' <EOL> ) <EOL> return { '<STR_LIT:username>' : response . get ( '<STR_LIT>' ) , <EOL> '<STR_LIT:email>' : response . get ( '<STR_LIT>' ) or <EOL> response . get ( '<STR_LIT>' , [ '<STR_LIT>' ] ) [ <NUM_LIT:0> ] , <EOL> '<STR_LIT>' : fullname , <EOL> '<STR_LIT>' : first_name , <EOL> '<STR_LIT>' : last_name } <EOL> def user_data ( self , access_token , * args , ** kwargs ) : <EOL> return self . get_json ( '<STR_LIT>' , <EOL> params = { '<STR_LIT>' : access_token , <EOL> '<STR_LIT>' : '<STR_LIT>' } ) </s>
