File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,11 @@ def _invoke_bedrock_model(prompt_body: dict, model_id: str) -> dict:
4444 region = os .environ ['AWS_DEFAULT_REGION' ]
4545 access_key = os .environ ['AWS_ACCESS_KEY_ID' ]
4646 secret_key = os .environ ['AWS_SECRET_ACCESS_KEY' ]
47+ if "AWS_SESSION_TOKEN" in os .environ :
48+ session_token = os .environ ['AWS_SESSION_TOKEN' ]
49+ logging .info (f"Session token: { session_token [:4 ]} " )
50+ else :
51+ session_token = None
4752
4853 logging .info (f"Region: { region } . Keys: { access_key [:4 ]} , { secret_key [:4 ]} " )
4954
@@ -88,6 +93,8 @@ def sign(key, msg):
8893 "Authorization" : f"{ algorithm } Credential={ access_key } /{ credential_scope } , "
8994 f"SignedHeaders={ signed_headers } , Signature={ signature } "
9095 }
96+ if session_token :
97+ headers ["X-Amz-Security-Token" ] = session_token
9198
9299 conn = http .client .HTTPSConnection (host )
93100 try :
You can’t perform that action at this time.
0 commit comments