
     `ib                    r    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            Z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                4    dd l } |j        ||| ||          S )Nr   )profile_nameregion_nameaws_access_key_idaws_secret_access_keyr   )boto3Session)r   r
   r   r   r   r   s         o/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/anthropic/lib/bedrock/_auth.py_get_sessionr      s7     LLL5=(,+       methodstrurlheadershttpx.Headersdatadict[str, str]c        	           ddl m}	 ddlm}
 t	          |||||          }|                                }|d=  |
|                                 |||          }|                                }|st          d           |	|d|j	                  }|
                    |           |                                }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                    i | ]
\  }}|||S )N ).0keyvalues      r   
<dictcomp>z$get_auth_headers.<locals>.<dictcomp>H   s#    \\\:3%J[CJ[J[J[r   )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preppeds                   r   get_auth_headersr;   !   s    ('''''......%%+  G llnnGjCtTTTG))++K IGHHHY{Iw/BCCF
OOGooG\\go)>)>)D)D)F)F\\\\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   r    )

__future__r   typingr   httpx_utilsr   r   r   r;   r'   r   r   <module>r@      s    " " " " " "                    LLL 3   &'] '] '] '] '] ']r   