Skip to content

Commit 02b578b

Browse files
committed
remove boto
1 parent 711af1a commit 02b578b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

test/test_utils.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff 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:

0 commit comments

Comments
 (0)