o
    h                     @   s<   d dl mZ d dlmZ d dlmZmZ G dd deZdS )    )app_settings)get_adapter)OAuth2ClientOAuth2Errorc                   @   s   e Zd ZdZdddZdS )UntappdOAuth2Clientz
    Custom client because Untappd:
        * uses redirect_url instead of redirect_uri
        * nests access_token inside an extra 'response' object
    Nc                 C   s   ddl m} | j| jdd| j|d}d }| | | j}| jdkr%|}d }|r-|r-||d< tj	
|ji }d|
d	d
i}t  j| j||||d}	d }
|	jdkrX|	 d }
|
r^d|
vretd|	j |
S )Nr   )UntappdProviderauthorization_codecode)	client_idredirect_url
grant_typeresponse_typeclient_secretr	   GETcode_verifierz
User-Agent
USER_AGENTzdjango-allauth)paramsdataheaders   responseaccess_tokenz!Error retrieving access token: %s)0allauth.socialaccount.providers.untappd.providerr   consumer_keycallback_urlconsumer_secret_strip_empty_keysaccess_token_urlaccess_token_methodr   	PROVIDERSgetidr   get_requests_sessionrequeststatus_codejsonr   content)selfr	   pkce_code_verifierr   r   r   urlsettingsr   respr    r,   e/var/www/html/pos/venv/lib/python3.10/site-packages/allauth/socialaccount/providers/untappd/client.pyget_access_token   sD   


z$UntappdOAuth2Client.get_access_token)N)__name__
__module____qualname____doc__r.   r,   r,   r,   r-   r      s    r   N)allauth.socialaccountr   allauth.socialaccount.adapterr   -allauth.socialaccount.providers.oauth2.clientr   r   r   r,   r,   r,   r-   <module>   s    