o
    Lf                     @   sl   d dl mZ d dlmZ d dlmZmZmZ ddl	m
Z
 ddlmZ G dd	 d	eZeeZeeZd
S )    )gettext_lazy)get_adapter)OAuth2AdapterOAuth2CallbackViewOAuth2LoginView   )ProviderException   )DoubanProviderc                   @   s&   e Zd ZejZdZdZdZdd Z	dS )DoubanOAuth2Adapterz*https://www.douban.com/service/auth2/tokenz)https://www.douban.com/service/auth2/authz"https://api.douban.com/v2/user/~mec           	      K   s^   dd|j  i}t  j| j|d}| }	 d|vr'|dtd}t||  	||S )NAuthorizationz	Bearer %s)headersidmsgzInvalid profile data)
tokenr   get_requests_sessiongetprofile_urljson_r   get_providersociallogin_from_response)	selfrequestappr   kwargsr   resp
extra_datar    r   m/var/www/html/humari/django-venv/lib/python3.10/site-packages/allauth/socialaccount/providers/douban/views.pycomplete_login   s   
z"DoubanOAuth2Adapter.complete_loginN)
__name__
__module____qualname__r
   r   provider_idaccess_token_urlauthorize_urlr   r    r   r   r   r   r      s    r   N)django.utils.translationr   r   allauth.socialaccount.adapterr   ,allauth.socialaccount.providers.oauth2.viewsr   r   r   baser   providerr
   r   adapter_viewoauth2_loginoauth2_callbackr   r   r   r   <module>   s    
