
    f                     ^    d dl mZmZ d dlmZ d dlmZ  G d de      Z G d de      ZegZ	y)	    )
AuthActionProviderAccount)OAuthProvider)TwitterOAuthAdapterc                   0     e Zd Zd Zd Zd Z fdZ xZS )TwitterAccountc                 L    | j                   j                  j                  d      S )z7The screen name is the username of the Twitter account.screen_name)account
extra_dataget)selfs    k/var/www/cs2snipe.com/venv/lib/python3.12/site-packages/allauth/socialaccount/providers/twitter/provider.pyget_screen_namezTwitterAccount.get_screen_name   s    ||&&**=99    c                 8    d }| j                         }|rd|z   }|S )Nzhttp://twitter.com/)r   )r   retr
   s      r   get_profile_urlzTwitterAccount.get_profile_url   s'    **,'+5C
r   c                 |    d }| j                   j                  j                  d      }|r|j                  dd      }|S )Nprofile_image_url_normal )r   r   r   replace)r   r   r   s      r   get_avatar_urlzTwitterAccount.get_avatar_url   s?     LL33778KL $++Ir:C
r   c                 P    | j                         }|xs t        t        |          S )N)r   superr   to_str)r   r
   	__class__s     r   r   zTwitterAccount.to_str   s&    **,BeND@BBr   )__name__
__module____qualname__r   r   r   r   __classcell__)r   s   @r   r   r      s    :C Cr   r   c                   .    e Zd ZdZdZeZeZd Z	d Z
d Zy)TwitterProvidertwitterTwitterc                 8    |t         j                  k(  rd}|S d}|S )Nz'https://api.twitter.com/oauth/authorizez*https://api.twitter.com/oauth/authenticate)r   REAUTHENTICATE)r   requestactionurls       r   get_auth_urlzTwitterProvider.get_auth_url&   s(    Z...;C 
 ?C
r   c                     t        |d         S )Nid)strr   datas     r   extract_uidzTwitterProvider.extract_uid-   s    4:r   c                 x    t        |j                  d      |j                  d      |j                  d            S )Nr
   nameemail)usernamer4   r5   )dictr   r0   s     r   extract_common_fieldsz%TwitterProvider.extract_common_fields0   s3    XXm,&!((7#
 	
r   N)r   r    r!   r.   r4   r   account_classr   oauth_adapter_classr,   r2   r8    r   r   r$   r$       s&    	BD"M-
r   r$   N)
$allauth.socialaccount.providers.baser   r   .allauth.socialaccount.providers.oauth.providerr   -allauth.socialaccount.providers.twitter.viewsr   r   r$   provider_classesr;   r   r   <module>r@      s3    L H MC_ C4
m 
0 $$ r   