o
    ¦i¾  ã                   @   s2   d Z ddlZddlmZmZmZ G dd„ dƒZdS )a‚  
urllib2.HTTPPasswordMgr object using the keyring, for use with the
urllib2.HTTPBasicAuthHandler.

usage:
    import urllib2
    handlers = [urllib2.HTTPBasicAuthHandler(PasswordMgr())]
    urllib2.install_opener(handlers)
    urllib2.urlopen(...)

This will prompt for a password if one is required and isn't already
in the keyring. Then, it adds it to the keyring for subsequent use.
é    Né   )Údelete_passwordÚget_passwordÚset_passwordc                   @   s,   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	S )
ÚPasswordMgrc                 C   s   t  ¡ S ©N)ÚgetpassÚgetuser)ÚselfÚrealmÚauthuri© r   úR/var/www/html/karishye-ai-python/venv/lib/python3.10/site-packages/keyring/http.pyÚget_username   s   zPasswordMgr.get_usernamec                 C   s   |   ||¡}t|||ƒ d S r   )r   r   )r
   r   r   ÚpasswordÚuserr   r   r   Úadd_password   s   zPasswordMgr.add_passwordc                 C   sT   |   ||¡}t||ƒ}|d u r&d|› d|› d|› d}t |¡}t|||ƒ ||fS )Nzpassword for ú@z for z: )r   r   r   r   )r
   r   r   r   r   Úpromptr   r   r   Úfind_user_password   s   

zPasswordMgr.find_user_passwordc                 C   s   |   ||¡}t||ƒ d S r   )r   r   )r
   r   r   r   r   r   r   Úclear_password%   s   zPasswordMgr.clear_passwordN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   r   r   r      s
    	r   )Ú__doc__r   Ú r   r   r   r   r   r   r   r   Ú<module>   s    