a
    ‹Qx_T  ã                   @   sl   d dl Z d dlmZ d dlmZmZmZ ddlmZ G dd„ deƒZ	G dd	„ d	eƒZ
e e
¡Ze e
¡ZdS )
é    N)ÚOAuth)ÚOAuthAdapterÚOAuthCallbackViewÚOAuthLoginViewé   )ÚTumblrProviderc                   @   s   e Zd ZdZdd„ ZdS )Ú	TumblrAPIz"http://api.tumblr.com/v2/user/infoc                 C   s   t  |  | j¡¡}|d d S )NÚresponseÚuser)ÚjsonÚloadsÚqueryÚurl)ÚselfÚdata© r   úd/var/www/html/Ranjet/env/lib/python3.9/site-packages/allauth/socialaccount/providers/tumblr/views.pyÚget_user_info   s    zTumblrAPI.get_user_infoN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   r      s   r   c                   @   s&   e Zd ZejZdZdZdZdd„ Z	dS )ÚTumblrOAuthAdapterz*https://www.tumblr.com/oauth/request_tokenz)https://www.tumblr.com/oauth/access_tokenz&https://www.tumblr.com/oauth/authorizec                 C   s,   t ||j|j| jƒ}| ¡ }|  ¡  ||¡S )N)r   Z	client_idZsecretÚrequest_token_urlr   Úget_providerZsociallogin_from_response)r   ÚrequestZappÚtokenr	   ZclientÚ
extra_datar   r   r   Úcomplete_login   s    z!TumblrOAuthAdapter.complete_loginN)
r   r   r   r   ÚidZprovider_idr   Zaccess_token_urlZauthorize_urlr   r   r   r   r   r      s
   r   )r   Z,allauth.socialaccount.providers.oauth.clientr   Z+allauth.socialaccount.providers.oauth.viewsr   r   r   Zproviderr   r   r   Zadapter_viewZoauth_loginZoauth_callbackr   r   r   r   Ú<module>   s   
