本文整理汇总了Python中pyamf.remoting.client.RemotingService.addHeader方法的典型用法代码示例。如果您正苦于以下问题:Python RemotingService.addHeader方法的具体用法?Python RemotingService.addHeader怎么用?Python RemotingService.addHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyamf.remoting.client.RemotingService
的用法示例。
在下文中一共展示了RemotingService.addHeader方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GetRemotingService
# 需要导入模块: from pyamf.remoting.client import RemotingService [as 别名]
# 或者: from pyamf.remoting.client.RemotingService import addHeader [as 别名]
def GetRemotingService(self, key, serviceName):
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)-5.5s [%(name)s] %(message)s')
headers = self.GetHeaders()
client = RemotingService(c_brightcove + "/services/messagebroker/amf?playerKey=" + key.encode("ascii"), amf_version=3,logger=logging, user_agent=headers['User-Agent'])
if self.httpManager.GetIsForwardedForIP():
forwardedIP = self.httpManager.GetForwardedForIP()
client.addHeader(u'X-Forwarded-For', forwardedIP)
# Connect to the Brightcove AMF service
service = client.getService(serviceName)
return service
示例2: get_rtmpdump_info
# 需要导入模块: from pyamf.remoting.client import RemotingService [as 别名]
# 或者: from pyamf.remoting.client.RemotingService import addHeader [as 别名]
def get_rtmpdump_info(domain, token, track, flash_url=None):
'''Return a tuple of (app ID, RTMP url); raises an Exception on failure.'''
if not flash_url:
flash_url = resolve_url(FLASH_PLAYER_URL)
svc = RemotingService(AMF_ENDPOINT, referer=flash_url, amf_version=3)
svc.addHeader('Auth', chr(5))
rdio_svc = svc.getService('rdio')
pi = rdio_svc.getPlaybackInfo({
'domain': domain,
'playbackToken': token,
'manualPlay': False,
'playerName': 'api_544189',
'type': 'flash',
'key': track})
if not pi:
raise Exception, 'Failed to get playback info'
return (
'ondemand?' + pi['auth'],
'rtmpe://cp102543.edgefcs.net:1935/ondemand/mp3:' + \
pi['surl'].replace('30s-96', 'full-192'))