o
    hA                     @   s0   d dl mZ d dlmZmZ G dd deZdS )    )get_adapter)OAuth2ClientOAuth2Errorc                   @   s   e Zd ZdddZdS )DingTalkOAuth2ClientNc                 C   s   | j | j|dd}d }|r||d< | | | j}| jdkr"|}d }t  j| j|||d}|  |	 }|r=d|vrDt
d|j |d|d< |d	|d
< |d|d< |S )Nauthorization_code)clientIdclientSecretcode	grantTypecode_verifierGET)paramsjsonaccessTokenz!Error retrieving access token: %saccess_tokenrefreshTokenrefresh_tokenexpireIn
expires_in)consumer_keyconsumer_secret_strip_empty_keysaccess_token_urlaccess_token_methodr   get_requests_sessionrequestraise_for_statusr   r   contentpop)selfr	   pkce_code_verifierdatar   urlrespr    r$   f/var/www/html/pos/venv/lib/python3.10/site-packages/allauth/socialaccount/providers/dingtalk/client.pyget_access_token   s4   

z%DingTalkOAuth2Client.get_access_token)N)__name__
__module____qualname__r&   r$   r$   r$   r%   r      s    r   N)allauth.socialaccount.adapterr   -allauth.socialaccount.providers.oauth2.clientr   r   r   r$   r$   r$   r%   <module>   s    