ok

Mini Shell

Direktori : /proc/self/root/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/network/
Upload File :
Current File : //proc/self/root/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/network/auth.pyo

�
Bu�_c@stdZddlZddlmZmZddlmZddlmZ	ddl
mZmZm
Z
mZmZddlmZer�ddlmZmZmZmZmZdd	lmZdd
lmZmZeeeefZneje �Z!yddl"a"WnEe#k
r"da"n/e%k
rPZ&e!j'dee&��da"nXd�Z(d
efd��YZ)dS(s�Network Authentication Helpers

Contains interface (MultiDomainBasicAuth) and associated glue code for
providing credentials in the context of network requests.
i����N(tAuthBaset
HTTPBasicAuth(tget_netrc_auth(tparse(taskt	ask_inputtask_passwordtremove_auth_from_urltsplit_auth_netloc_from_url(tMYPY_CHECK_RUNNING(tDicttOptionaltTupletListtAny(tAuthInfo(tResponsetRequests*Keyring is skipped due to an exception: %scCs�|strdSy�y
tj}Wntk
r5n@Xtjd|�|||�}|dk	rq|j|jfSdS|r�tjd|�tj||�}|r�||fSnWn/t	k
r�}tj
dt|��danXdS(s3Return the tuple auth for a given url from keyring.s'Getting credentials from keyring for %ss$Getting password from keyring for %ss*Keyring is skipped due to an exception: %sN(tkeyringtNonetget_credentialtAttributeErrortloggertdebugtusernametpasswordtget_passwordt	Exceptiontwarningtstr(turlRRtcredRtexc((sK/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/network/auth.pytget_keyring_auth,s,


tMultiDomainBasicAuthcBsneZed
d�Zd�Zeed�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
RS(cCs(||_||_i|_d|_dS(N(t	promptingt
index_urlst	passwordsRt_credentials_to_save(tselfR#R$((sK/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/network/auth.pyt__init__Os			cCsY|s|jrdSx=|jD]2}t|�jd�d}|j|�r|SqWdS(s�Return the original index URL matching the requested URL.

        Cached or dynamically generated credentials may work against
        the original index URL rather than just the netloc.

        The provided url should have had its username and password
        removed already. If the original index url had credentials then
        they will be included in the return value.

        Returns None if no matching index was found, or if --no-index
        was specified by the user.
        t/N(R$RRtrstript
startswith(R'Rtutprefix((sK/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/network/auth.pyt_get_index_url[scCsdt|�\}}}|\}}|dk	rM|dk	rMtjd|�|S|j|�}	|	r�t|	�}
|
r�|
\}	}}tjd|	�q�n|	r�|ddk	r�|\}}|dk	r�|dk	r�tjd|�|Sn|rt|�}
|
rtjd|�|
Sn|rZt|	|�p:t||�}|rZtjd|�|Sn||fS(s2Find and return credentials for the specified URL.sFound credentials in url for %ssFound index url %sis%Found credentials in index url for %ss!Found credentials in netrc for %ss#Found credentials in keyring for %sN(RRRRR.RR!(R'toriginal_urltallow_netrct
allow_keyringRtnetlocturl_user_passwordRRt	index_urlt
index_infot_tindex_url_user_passwordt
netrc_authtkr_auth((sK/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/network/auth.pyt_get_new_credentialsrs:cCs�t|�\}}}|jj|d�\}}|dkr`|dkr`|j|�\}}n|dk	sx|dk	r�|p�d}|p�d}||f|j|<n|||fS(s_Return the credentials to use for the provided URL.

        If allowed, netrc and keyring may be used to obtain the
        correct credentials.

        Returns (url_without_credentials, username, password). Note
        that even if the original URL contains credentials, this
        function may return a different username and password.
        tN(NN(RR%tgetRR:(R'R/RR2R6RR((sK/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/network/auth.pyt_get_url_and_credentials�s	cCsk|j|j�\}}}||_|dk	rT|dk	rTt||�|�}n|jd|j�|S(Ntresponse(R=RRRt
register_hookt
handle_401(R'treqRRR((sK/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/network/auth.pyt__call__�s	cCs�tdj|��}|s(ddtfSt||�}|rr|ddk	rr|ddk	rr|d|dtfStd�}||tfS(Ns
User for {}: iis
Password: (RtformatRtFalseR!RtTrue(R'R2RtauthR((sK/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/network/auth.pyt_prompt_for_password�s
&cCs#ts
tStdddg�dkS(Ns#Save credentials to keyring [y/N]: tytn(RRDR(R'((sK/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/network/auth.pyt _should_save_password_to_keyring�sc	KsD|jdkr|S|js |Stj|j�}|j|j�\}}}d|_|dk	r�|dk	r�||f|j	|j<|r�|j
�r�|j||f|_q�n|j|jj
�t|p�d|p�d�|j�}|jd|j�|jr|jd|j�n|jj||�}|jj|�|S(Ni�R;R>(tstatus_codeR#turllib_parseturlparseRRGR2RR&R%RJtcontenttrawtrelease_connRtrequestR?twarn_on_401tsave_credentialst
connectiontsendthistorytappend(	R'tresptkwargstparsedRRtsaveRAtnew_resp((sK/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/network/auth.pyR@�s(		
$	cKs,|jdkr(tjd|jj�ndS(s6Response callback to warn about incorrect credentials.i�s)401 Error, Credentials not correct for %sN(RKRRRQR(R'RXRY((sK/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/network/auth.pyRR scKswts
dS|j}d|_|rs|jdkrsytjd�tj|�Wqstk
rotjd�qsXndS(s1Response callback to save credentials on success.Ni�sSaving credentials to keyringsFailed to save credentials(	RR&RRKRtinfotset_passwordRt	exception(R'RXRYtcreds((sK/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/network/auth.pyRS(s		

N(t__name__t
__module__RERR(R.R:R=RBRGRJR@RRRS(((sK/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/network/auth.pyR"Ms	2	)				.	(*t__doc__tloggingtpip._vendor.requests.authRRtpip._vendor.requests.utilsRtpip._vendor.six.moves.urllibRRLtpip._internal.utils.miscRRRRRtpip._internal.utils.typingR	ttypingR
RRR
Rt pip._internal.vcs.versioncontrolRtpip._vendor.requests.modelsRRRtCredentialst	getLoggerRaRRtImportErrorRRR RR!R"(((sK/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/network/auth.pyt<module>s,((
	
	!

Zerion Mini Shell 1.0