o
    +ib                     @  sZ   d dl mZ d dlmZ d dlZddlmZ erd dlZedddddZdddZ	dS )    )annotations)TYPE_CHECKINGN   )	lru_cachei   )maxsizeaws_access_key
str | Noneaws_secret_keyaws_session_tokenregionprofilereturnboto3.Sessionc                 C  s   dd l }|j||| ||dS )Nr   )profile_nameregion_nameaws_access_key_idaws_secret_access_keyr
   )boto3Session)r   r	   r
   r   r   r    r   X/var/www/html/psymed-ai/venv/lib/python3.10/site-packages/anthropic/lib/bedrock/_auth.py_get_session   s   	r   methodstrurlheadershttpx.Headersdatadict[str, str]c        	         C  s   ddl m}	 ddlm}
 t|||||d}| }|d= |
|  |||d}| }|s0td|	|d|j	}|
| | }d	d
 t|j D S )Nr   )	SigV4Auth)
AWSRequest)r   r   r   r	   r
   
connection)r   r   r   r   z*could not resolve credentials from sessionbedrockc                 S  s   i | ]\}}|d ur||qS )Nr   ).0keyvaluer   r   r   
<dictcomp>H   s    z$get_auth_headers.<locals>.<dictcomp>)botocore.authr   botocore.awsrequestr    r   copyupperget_credentialsRuntimeErrorr   add_authpreparedictr   items)r   r   r   r   r	   r
   r   r   r   r   r    sessionrequestcredentialssignerpreppedr   r   r   get_auth_headers!   s&   
r6   )r   r   r	   r   r
   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   r	   r   r
   r   r   r   r   r   r   r   r   r   )

__future__r   typingr   httpx_utilsr   r   r   r6   r   r   r   r   <module>   s    