Amazon Kinesis视频GetMedia/PutMedia [英] Amazon Kinesis Video GetMedia/PutMedia

查看:75
本文介绍了Amazon Kinesis视频GetMedia/PutMedia的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了python 3.6,我想使用API​​将视频流发布到awine kinesis. 我使用python aws客户端创建流和GetDataEndPoint,但是当我想用自定义请求发布数据(PutMedia实际上不包含在python客户端中)时,出现错误Unable to determine service/operation name to be authorized.

I used python 3.6 and I want to post video stream to aws kinesis with API. I used python aws client to create stream and GetDataEndPoint but when I want to post my data with my custom request (PutMedia doesn't include in python client actually), I get an error Unable to determine service/operation name to be authorized.

我已遵循AWS Kinesis视频媒体的api文档 GetMedia

I've follow the api doc of aws kinesis video media PutMedia and GetMedia.

因此,我首先使用然后我将数据发布到以下网址:

and I post my data at this 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

所以我不明白为什么会出现此错误...我已经找到了这个

So I don't understand why I get this error... I've found this troubleshooting on aws doc. But they say we must specify ApiName parameter. What I do...

如果未正确指定端点,则可能会发生此错误.获取端点时,请确保在GetDataEndpoint调用中包含以下参数,具体取决于要调用的API:

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方法是否在客户端中实际实现,因为他们说

I'm also wondering if the GetMedia method is actually implemented in client as they say 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

推荐答案

您收到的错误是因为您提供的端点可能没有在您的情况下为putMedia的操作".

The error you're getting is because you're probably providing the endpoint without the "action" that in your case would be putMedia.

尝试将/putMedia附加到端点,不要忘记指定"content-type": "application/json"标头.

Try to append /putMedia to your endpoint and don't forget to specify the "content-type": "application/json" header.

此外,您还必须生成 v4签名.您可以使用lib或遵循此 python指南做到这一点.

Btw you have also to generate the v4 signatures for your request. You can use a lib or follow this python guide to do it.

这篇关于Amazon Kinesis视频GetMedia/PutMedia的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆