
    陜i                     8    d Z ddlZddlmZmZmZ  G d d      Zy)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                   $    e Zd Zd Zd Zd Zd Zy)PasswordMgrc                 *    t        j                         S N)getpassgetuser)selfrealmauthuris      H/mnt/e/genesis-system/.venv/lib/python3.12/site-packages/keyring/http.pyget_usernamezPasswordMgr.get_username   s          c                 B    | j                  ||      }t        |||       y r
   )r   r   )r   r   r   passwordusers        r   add_passwordzPasswordMgr.add_password   s       0UD(+r   c                     | j                  ||      }t        ||      }|.d| d| d| d}t        j                  |      }t        |||       ||fS )Nzpassword for @z for z: )r   r   r   r   )r   r   r   r   r   prompts         r   find_user_passwordzPasswordMgr.find_user_password   sd      0t,$TF!E7%yCFv.Hh/X~r   c                 @    | j                  ||      }t        ||       y r
   )r   r   )r   r   r   r   s       r   clear_passwordzPasswordMgr.clear_password%   s      0t$r   N)__name__
__module____qualname__r   r   r   r    r   r   r   r      s    !,%r   r   )__doc__r    r   r   r   r   r    r   r   <module>r#      s     9 9% %r   