<s> from allauth . socialaccount import providers <EOL> from allauth . socialaccount . providers . base import ProviderAccount <EOL> from allauth . socialaccount . providers . oauth2 . provider import OAuth2Provider <EOL> class SoundCloudAccount ( ProviderAccount ) : <EOL> def get_profile_url ( self ) : <EOL> return self . account . extra_data . get ( '<STR_LIT>' ) <EOL> def get_avatar_url ( self ) : <EOL> return self . account . extra_data . get ( '<STR_LIT>' ) <EOL> def to_str ( self ) : <EOL> dflt = super ( SoundCloudAccount , self ) . to_str ( ) <EOL> full_name = self . account . extra_data . get ( '<STR_LIT>' ) <EOL> username = self . account . extra_data . get ( '<STR_LIT:username>' ) <EOL> return full_name or username or dflt <EOL> class SoundCloudProvider ( OAuth2Provider ) : <EOL> id = '<STR_LIT>' <EOL> name = '<STR_LIT>' <EOL> account_class = SoundCloudAccount <EOL> def extract_uid ( self , data ) : <EOL> return str ( data [ '<STR_LIT:id>' ] ) <EOL> def extract_common_fields ( self , data ) : <EOL> return dict ( name = data . get ( '<STR_LIT>' ) , <EOL> username = data . get ( '<STR_LIT:username>' ) , <EOL> email = data . get ( '<STR_LIT:email>' ) ) <EOL> providers . registry . register ( SoundCloudProvider ) </s>
