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.pyc

�
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:c
Cs�t|�\}}}|jj|d�\}}|dkr`|dkr`|j|�\}}n|dk	sx|dk	r�|p�d}|p�d}||f|j|<n|dk	r�|dk	s�|dkr�|dks�tdj|���|||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.
        ts'Could not load credentials from url: {}N(NN(RR%tgetRR:tAssertionErrortformat(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: (RR>RtFalseR!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(RRER(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_parseturlparseRRHR2RR&R%RKtcontenttrawtrelease_connRtrequestRAtwarn_on_401tsave_credentialst
connectiontsendthistorytappend(	R'tresptkwargstparsedRRtsaveRCtnew_resp((sK/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/network/auth.pyRB�s(		
$	cKs,|jdkr(tjd|jj�ndS(s6Response callback to warn about incorrect credentials.i�s)401 Error, Credentials not correct for %sN(RLRRRRR(R'RYRZ((sK/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/network/auth.pyRS scKs�tdk	std��ts"dS|j}d|_|r�|jdkr�ytjd�tj|�Wq�tk
r�tj	d�q�XndS(s1Response callback to save credentials on success.s'should never reach here without keyringNi�sSaving credentials to keyringsFailed to save credentials(
RRR=R&RLRtinfotset_passwordRt	exception(R'RYRZtcreds((sK/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/network/auth.pyRT(s		

N(t__name__t
__module__RFRR(R.R:R?RDRHRKRBRSRT(((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.urllibRRMtpip._internal.utils.miscRRRRRtpip._internal.utils.typingR	ttypingR
RRR
Rt pip._internal.vcs.versioncontrolRtpip._vendor.requests.modelsRRRtCredentialst	getLoggerRbRRtImportErrorRRR RR!R"(((sK/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/network/auth.pyt<module>s,((
	
	!

Zerion Mini Shell 1.0