
    f                         d dl mZ d dlmZ d dlmZmZmZ  G d de      Z ej                  e      Z
 ej                  e      Zy)    )get_adapter)OAuth2Error)OAuth2AdapterOAuth2CallbackViewOAuth2LoginViewc                   "    e Zd ZdZdZdZdZd Zy)TwitchOAuth2Adaptertwitchz!https://id.twitch.tv/oauth2/tokenz%https://id.twitch.tv/oauth2/authorizez!https://api.twitch.tv/helix/usersc                 (   dj                  |j                        |j                  d}t               j	                         j                  | j                  |      }|j                         }|j                  dk\  r6|j                  dd      }|j                  dd      }	t        d|d	|	d
      	 |j                  dg       d   }
d|
vrt        d|
z        | j                         j                  ||
      S # t        $ r t        d|z        w xY w)Nz	Bearer {})Authorizationz	Client-ID)headersi  error messagezTwitch API Error: z ()datar   z Invalid data from Twitch API: %sid)formattoken	client_idr   get_requests_sessiongetprofile_urljsonstatus_coder   
IndexErrorget_providersociallogin_from_response)selfrequestappr   kwargsr   responser   r   r   	user_infos              g/var/www/cs2snipe.com/venv/lib/python3.12/site-packages/allauth/socialaccount/providers/twitch/views.pycomplete_loginz"TwitchOAuth2Adapter.complete_login   s   (//<

 M..044T5E5Ew4W 	 }}3&HHWb)Ehhy"-GUGLMM	K,Q/I y @INOO  "<<WiPP  	K@DIJJ	Ks   2C9 9DN)__name__
__module____qualname__provider_idaccess_token_urlauthorize_urlr   r&        r%   r	   r	   
   s    K:;M5KQr.   r	   N)allauth.socialaccount.adapterr   -allauth.socialaccount.providers.oauth2.clientr   ,allauth.socialaccount.providers.oauth2.viewsr   r   r   r	   adapter_viewoauth2_loginoauth2_callbackr-   r.   r%   <module>r5      sM    5 E Q- Q@ ,++,?@1$112EFr.   