o
    &zh                     @   sH   d dl mZ d dlmZmZmZ G dd deZeeZeeZ	dS )    )get_adapter)OAuth2AdapterOAuth2CallbackViewOAuth2LoginViewc                   @   s,   e Zd ZdZdZdZdZdd Zdd Zd	S )
TumblrOAuth2Adaptertumblr_oauth2z&https://api.tumblr.com/v2/oauth2/tokenz'https://www.tumblr.com/oauth2/authorizez#https://api.tumblr.com/v2/user/infoc                 C   s   |  |}|  ||S )N)get_user_infoget_providersociallogin_from_response)selfrequestapptokenresponse
extra_data r   n/var/www/html/kangema/venv/lib/python3.10/site-packages/allauth/socialaccount/providers/tumblr_oauth2/views.pycomplete_login   s   
z"TumblrOAuth2Adapter.complete_loginc                 C   s<   t   j| jdd|j id}|  | d d }|S )NAuthorizationzBearer )headersr   user)r   get_requests_sessiongetprofile_urlr   raise_for_statusjson)r   r   respr   r   r   r   r      s   z!TumblrOAuth2Adapter.get_user_infoN)	__name__
__module____qualname__provider_idaccess_token_urlauthorize_urlr   r   r   r   r   r   r   r   	   s    r   N)
allauth.socialaccount.adapterr   ,allauth.socialaccount.providers.oauth2.viewsr   r   r   r   adapter_viewoauth2_loginoauth2_callbackr   r   r   r   <module>   s
    
