
    f)                         d dl mZ d dlmZ d dlmZ d dlmZmZm	Z	  G d de      Z
 G d de      Z e	j                  e      Z ej                  e      Zy	)
    )ElementTree)
ExpatError)OAuth)OAuthAdapterOAuthCallbackViewOAuthLoginViewc                       e Zd ZdZd Zy)OpenStreetMapAPIz2https://api.openstreetmap.org/api/0.6/user/detailsc                 P   | j                  | j                        }	 t        j                  |      j	                  d      }|j
                  }|j	                  d      }|,|j                  d|j
                  j                  d      i       |S # t        t        t        f$ r Y y w xY w)Nuserimgavatarhref)queryurlr   
fromstringfindattribupdategetr   KeyError
IndexError)selfraw_xmluser_element	user_infouser_avatars        n/var/www/cs2snipe.com/venv/lib/python3.12/site-packages/allauth/socialaccount/providers/openstreetmap/views.pyget_user_infozOpenStreetMapAPI.get_user_info   s    **TXX&	&11':??GL$++I&++E2K&  (K,>,>,B,B6,J!KLHj1 		s   A0B B%$B%N)__name__
__module____qualname__r   r        r   r
   r
      s    
>C
r$   r
   c                   "    e Zd ZdZdZdZdZd Zy)OpenStreetMapOAuthAdapteropenstreetmapz1https://www.openstreetmap.org/oauth/request_tokenz0https://www.openstreetmap.org/oauth/access_tokenz-https://www.openstreetmap.org/oauth/authorizec                     t        ||j                  |j                  | j                        }|j	                         }| j                         j                  ||      S )N)r
   	client_idsecretrequest_token_urlr   get_providersociallogin_from_response)r   requestapptokenresponseclient
extra_datas          r   complete_loginz(OpenStreetMapOAuthAdapter.complete_login"   sO    !S]]CJJ0F0F
 ))+
  "<<WjQQr$   N)r    r!   r"   provider_idr+   access_token_urlauthorize_urlr4   r#   r$   r   r&   r&      s    !KKICMRr$   r&   N)	xml.etreer   xml.parsers.expatr   ,allauth.socialaccount.providers.oauth.clientr   +allauth.socialaccount.providers.oauth.viewsr   r   r   r
   r&   adapter_viewoauth_loginoauth_callbackr#   r$   r   <module>r?      s[    ! ( > u  R R *n))*CD/"//0IJr$   