o
    Vh                     @   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   `/var/www/html/construction_image-detection-poc/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    