<s> from xml . dom import minidom <EOL> from social . backends . oauth import BaseOAuth2 <EOL> class NaverOAuth2 ( 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> EXTRA_DATA = [ <EOL> ( '<STR_LIT:id>' , '<STR_LIT:id>' ) , <EOL> ] <EOL> def get_user_id ( self , details , response ) : <EOL> return response . get ( '<STR_LIT:id>' ) <EOL> def get_user_details ( self , response ) : <EOL> """<STR_LIT>""" <EOL> return { <EOL> '<STR_LIT:username>' : response . get ( '<STR_LIT:username>' ) , <EOL> '<STR_LIT:email>' : response . get ( '<STR_LIT:email>' ) , <EOL> '<STR_LIT>' : response . get ( '<STR_LIT:username>' ) , <EOL> } <EOL> def user_data ( self , access_token , * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> response = self . request ( <EOL> '<STR_LIT>' , <EOL> headers = { <EOL> '<STR_LIT>' : '<STR_LIT>' . format ( access_token ) , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } <EOL> ) <EOL> dom = minidom . parseString ( response . text . encode ( '<STR_LIT:utf-8>' ) . strip ( ) ) <EOL> return { <EOL> '<STR_LIT:id>' : self . _dom_value ( dom , '<STR_LIT:id>' ) , <EOL> '<STR_LIT:email>' : self . _dom_value ( dom , '<STR_LIT:email>' ) , <EOL> '<STR_LIT:username>' : self . _dom_value ( dom , '<STR_LIT:name>' ) , <EOL> '<STR_LIT>' : self . _dom_value ( dom , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : self . _dom_value ( dom , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : self . _dom_value ( dom , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : self . _dom_value ( dom , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : self . _dom_value ( dom , '<STR_LIT>' ) <EOL> } <EOL> def auth_headers ( self ) : <EOL> client_id , client_secret = self . get_key_and_secret ( ) <EOL> return { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:code>' : self . data . get ( '<STR_LIT:code>' ) , <EOL> '<STR_LIT>' : client_id , <EOL> '<STR_LIT>' : client_secret , <EOL> } <EOL> def _dom_value ( self , dom , key ) : <EOL> return dom . getElementsByTagName ( key ) [ <NUM_LIT:0> ] . childNodes [ <NUM_LIT:0> ] . data </s>
