U
    ÔÉ>i  ã                   @   sX   d dl mZ d dlmZmZmZ G dd„ deƒZG dd„ deƒZe e¡Z	e e¡Z
dS )é    )ÚOAuth)ÚOAuthAdapterÚOAuthCallbackViewÚOAuthLoginViewc                   @   s   e Zd ZdZdd„ ZdS )Ú
DiscogsAPIz&https://api.discogs.com/oauth/identityc                 C   s   |   | j¡ ¡ }|S ©N)ÚqueryÚurlÚjson)ÚselfÚdata© r   úQ/tmp/pip-unpacked-wheel-upujnpc2/allauth/socialaccount/providers/discogs/views.pyÚget_user_info   s    zDiscogsAPI.get_user_infoN)Ú__name__Ú
__module__Ú__qualname__r	   r   r   r   r   r   r   	   s   r   c                   @   s$   e Zd ZdZdZdZdZdd„ ZdS )ÚDiscogsOAuthAdapterZdiscogsz+https://api.discogs.com/oauth/request_tokenz*https://api.discogs.com/oauth/access_tokenz#https://discogs.com/oauth/authorizec                 C   s,   t ||j|j| jƒ}| ¡ }|  ¡  ||¡S r   )r   Z	client_idÚsecretÚrequest_token_urlr   Úget_providerZsociallogin_from_response)r   ÚrequestZappÚtokenÚresponseÚclientÚ
extra_datar   r   r   Úcomplete_login   s    z"DiscogsOAuthAdapter.complete_loginN)r   r   r   Zprovider_idr   Zaccess_token_urlZauthorize_urlr   r   r   r   r   r      s
   r   N)Z,allauth.socialaccount.providers.oauth.clientr   Z+allauth.socialaccount.providers.oauth.viewsr   r   r   r   r   Zadapter_viewZoauth_loginZoauth_callbackr   r   r   r   Ú<module>   s
   
