亚马逊运动视频 GetMedia/PutMedia
Amazon Kinesis Video GetMedia/PutMedia
我使用 python 3.6,我想 post 视频流到 API aws kinesis。
我使用 python aws 客户端创建流和 GetDataEndPoint
但是当我想 post 我的数据和我的自定义请求时(PutMedia
不包含在 python实际上是客户端),我得到一个错误 Unable to determine service/operation name to be authorized
.
我已经关注了 aws kinesis video media 的 api 文档 PutMedia and GetMedia。
所以我首先使用 GetDataEndPoint
和 client method:
获取端点
response = client.get_data_endpoint( # aws client method
StreamName=STREAM_NAME,
APIName='PUT_MEDIA'
)
end_point = response['DataEndpoint'] # https://s-EXAMPLE.kinesisvideo.eu-west-1.amazonaws.com
我post我的数据在url:
headers = {
"x-amzn-stream-arn": STREAM_ARN,
"x-amzn-fragment-timecode-type": "ABSOLUTE",
"x-amzn-producer-start-timestamp": start_tmstp
}
# Sign header...
response = requests.post(end_point, data=data, headers=headers) # 403 - Unable to determine service/operation name to be authorized
所以我不明白为什么会出现此错误...我在 aws doc 上找到了这个 troubleshooting。但是他们说我们必须指定 ApiName 参数。我做什么...
This error might occur if the endpoint is not properly specified. When you are getting the endpoint, be sure to include the following parameter in the GetDataEndpoint call, depending on the API to be called:
我也想知道 GetMedia
方法是否真的像他们所说的那样在客户端中实现 here because when I debug this method, client don't call GetDataEndPoint
and so make request at https://kinesisvideo.region.amazonaws.com
insteed of https://ID_EXAMPLE.kinesisvideo.region.amazonaws.com
. So method get error Unable to determine service/operation name to be authorized
as explained in troubleshooting
你得到的错误是因为你可能提供了没有 "action" 的端点,在你的情况下是 putMedia
.
尝试将 /putMedia
附加到您的端点,并且不要忘记指定 "content-type": "application/json"
header。
顺便说一句,您还必须生成 v4 signatures for your request. You can use a lib or follow this python guide 才能执行此操作。
我使用 python 3.6,我想 post 视频流到 API aws kinesis。
我使用 python aws 客户端创建流和 GetDataEndPoint
但是当我想 post 我的数据和我的自定义请求时(PutMedia
不包含在 python实际上是客户端),我得到一个错误 Unable to determine service/operation name to be authorized
.
我已经关注了 aws kinesis video media 的 api 文档 PutMedia and GetMedia。
所以我首先使用 GetDataEndPoint
和 client method:
response = client.get_data_endpoint( # aws client method
StreamName=STREAM_NAME,
APIName='PUT_MEDIA'
)
end_point = response['DataEndpoint'] # https://s-EXAMPLE.kinesisvideo.eu-west-1.amazonaws.com
我post我的数据在url:
headers = {
"x-amzn-stream-arn": STREAM_ARN,
"x-amzn-fragment-timecode-type": "ABSOLUTE",
"x-amzn-producer-start-timestamp": start_tmstp
}
# Sign header...
response = requests.post(end_point, data=data, headers=headers) # 403 - Unable to determine service/operation name to be authorized
所以我不明白为什么会出现此错误...我在 aws doc 上找到了这个 troubleshooting。但是他们说我们必须指定 ApiName 参数。我做什么...
This error might occur if the endpoint is not properly specified. When you are getting the endpoint, be sure to include the following parameter in the GetDataEndpoint call, depending on the API to be called:
我也想知道 GetMedia
方法是否真的像他们所说的那样在客户端中实现 here because when I debug this method, client don't call GetDataEndPoint
and so make request at https://kinesisvideo.region.amazonaws.com
insteed of https://ID_EXAMPLE.kinesisvideo.region.amazonaws.com
. So method get error Unable to determine service/operation name to be authorized
as explained in troubleshooting
你得到的错误是因为你可能提供了没有 "action" 的端点,在你的情况下是 putMedia
.
尝试将 /putMedia
附加到您的端点,并且不要忘记指定 "content-type": "application/json"
header。
顺便说一句,您还必须生成 v4 signatures for your request. You can use a lib or follow this python guide 才能执行此操作。