本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
用户应使用签名版本 4 签名流程为通过HTTP客户端发送的 HealthLake API请求添加身份验证。要了解更多信息,请参阅签名版本 4 的签名流程。
要使用适用于 AWS SDK Python 的 sigv4 授权,请创建一个类似于以下示例的脚本。
import boto3
import requests
import json
from requests_auth_aws_sigv4 import AWSSigV4
# Set the input arguments
data_store_endpoint = 'https://healthlake.us-east-1.amazonaws.com/datastore/<datastore id>/r4//'
resource_path = "Patient"
requestBody = {"resourceType": "Patient", "active": True, "name": [{"use": "official","family": "Dow","given": ["Jen"]},{"use": "usual","given": ["Jen"]}],"gender": "female","birthDate": "1966-09-01"}
region = 'us-east-1'
#Frame the resource endpoint
resource_endpoint = data_store_endpoint+resource_path
session = boto3.session.Session(region_name=region)
client = session.client("healthlake")
# Frame authorization
auth = AWSSigV4("healthlake", session=session)
# Calling data store FHIR endpoint using SigV4 auth
r = requests.post(resource_endpoint, json=requestBody, auth=auth, )
print(r.json())
有关使用 AWS SDK Python 的 sigv4 授权的其他信息可以在 Boto