本文整理汇总了Python中entertainment.net.Net.http_POST_BINARY方法的典型用法代码示例。如果您正苦于以下问题:Python Net.http_POST_BINARY方法的具体用法?Python Net.http_POST_BINARY怎么用?Python Net.http_POST_BINARY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entertainment.net.Net
的用法示例。
在下文中一共展示了Net.http_POST_BINARY方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GetPlayableUrl
# 需要导入模块: from entertainment.net import Net [as 别名]
# 或者: from entertainment.net.Net import http_POST_BINARY [as 别名]
def GetPlayableUrl(amf_constant, url, experience_id, player_key, content_id=None, content_ref_id=None):
from pyamf import remoting
from entertainment.net import Net
net = Net()
amf_request_data = BuildAmfRequest(amf_constant, url, experience_id, player_key, content_id=content_id, content_ref_id=content_ref_id)
amf_encoded_request_data = remoting.encode(amf_request_data).read()
amf_encoded_response_data = net.http_POST_BINARY(
'http://c.brightcove.com',
"/services/messagebroker/amf?playerKey=" + player_key.encode('ascii'),
amf_encoded_request_data,
headers = {'content-type': 'application/x-amf'} ).content
amf_response_data = remoting.decode(amf_encoded_response_data).bodies[0][1].body
playable_url = amf_response_data['programmedContent']['videoPlayer']['mediaDTO']['FLVFullLengthURL']
# do something with renditions ... to get best quality
# renditions = amf_response_data['programmedContent']['videoPlayer']['mediaDTO']['renditions']
# sample renditions below
'''
'renditions': [{'videoCodec': u'ON2', 'defaultURL': u'http://brightcove03-f.akamaihd.net/[email protected]',
'encodingRate': 250000, 'audioOnly': False, 'videoContainer': 1, 'mediaDeliveryType': 0, 'frameWidth': 384, 'size': 0.0, 'frameHeight': 512},
{'videoCodec': u'ON2', 'defaultURL': u'http://brightcove03-f.akamaihd.net/[email protected]', 'encodingRate': 600000, 'audioOnly': False,
'videoContainer': 1, 'mediaDeliveryType': 0, 'frameWidth': 480, 'size': 0.0, 'frameHeight': 640},
{'videoCodec': u'ON2', 'defaultURL': u'http://brightcove03-f.akamaihd.net/[email protected]', 'encodingRate': 64000, 'audioOnly': False,
'videoContainer': 1, 'mediaDeliveryType': 0, 'frameWidth': 240, 'size': 0.0, 'frameHeight': 320},
{'videoCodec': u'ON2', 'defaultURL': u'http://brightcove03-f.akamaihd.net/[email protected]', 'encodingRate': 1200000, 'audioOnly': False,
'videoContainer': 1, 'mediaDeliveryType': 0, 'frameWidth': 480, 'size': 0.0, 'frameHeight': 720}]
'''
return playable_url