[英]Amazon Kinesis Video GetMedia/PutMedia
我使用python 3.6,我想使用API將視頻流發布到aws kinesis。 我使用python aws客戶端創建流和GetDataEndPoint
但是當我想用自定義請求發布數據時( PutMedia
實際上不包含在python客戶端中),我收到錯誤消息, Unable to determine service/operation name to be authorized
。
我遵循aws kinesis視頻媒體PutMedia和GetMedia的api文檔。
因此,我首先使用客戶端方法通過GetDataEndPoint
獲取端點:
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
然后將數據發布到以下網址:
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文檔上找到了此疑難解答 。 但是他們說我們必須指定ApiName參數。 我所做的...
如果未正確指定端點,則可能會發生此錯誤。 獲取端點時,請確保在GetDataEndpoint調用中包括以下參數,具體取決於要調用的API:
我也想知道GetMedia
方法是否實際上在客戶端中實現了,因為他們在這里說,因為在調試此方法時,客戶端不會調用GetDataEndPoint
並因此在https://kinesisvideo.region.amazonaws.com
發出請求,而使用https://ID_EXAMPLE.kinesisvideo.region.amazonaws.com
。 因此方法出現錯誤Unable to determine service/operation name to be authorized
按照故障排除中的說明Unable to determine service/operation name to be authorized
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.