File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/__pycache__/iam.cpython-310.pyc
o
�N�g� � @ sd d Z ddlZddlZddlZzddlZdZW n ey! dZY nw e�e�Z ddd�Z
d d
� ZdS )z7
Connection library for Amazon IAM
:depends: requests
� NTF�
� c C s� t d|�D ]e}d}z$tj| |ddid�}t|d�r|jW S t|d�r*|jW S W dS tjjyC } zW Y d}~ dS d}~w tyT } zW Y d}~nd}~ww t �
d|� t �
t�|�� t
�d | � qt �d
|� dS )zI
Retry grabbing a URL.
Based heavily on boto.utils.retry_url
r N�http� )�timeoutZproxies�text�contentz/Caught exception reading from URL. Retry no. %s� z0Failed to read from URL for %s times. Giving up.)�range�requests�get�hasattrr r �
exceptions� HTTPError� Exception�log�warning�pprintZpformat�time�sleep�error)�urlZnum_retriesr �i�exc�result� r �B/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/iam.py�_retry_get_url s*
���r c C s | S )z/
Stolen completely from boto.providers
r )�keyr r r �_convert_key_to_str0 s r )r r )�__doc__�loggingr r r ZHAS_REQUESTS�ImportError� getLogger�__name__r r r r r r r �<module> s �