当前位置: 首页>>代码示例>>Python>>正文


Python RemotingService.setProxy方法代码示例

本文整理汇总了Python中pyamf.remoting.client.RemotingService.setProxy方法的典型用法代码示例。如果您正苦于以下问题:Python RemotingService.setProxy方法的具体用法?Python RemotingService.setProxy怎么用?Python RemotingService.setProxy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyamf.remoting.client.RemotingService的用法示例。


在下文中一共展示了RemotingService.setProxy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_amf

# 需要导入模块: from pyamf.remoting.client import RemotingService [as 别名]
# 或者: from pyamf.remoting.client.RemotingService import setProxy [as 别名]
def get_amf(url, service, *args):
    # AMF remoting
    #gateway = RemotingService(url, pyamf.AMF0, user_agent='Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31')

    r = None
    for i in range(10):
        DBG('attempt', i)
        squid = tm.choose_proxy(url)
        DBG('proxy', squid['name'])

        gateway = RemotingService(url, pyamf.AMF0, user_agent='Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31', opener=urlopen_with_timeout)
        #gateway.setProxy('10.8.0.10:8888')
        gateway.setProxy('%s:%s' % (squid['ip'], int(squid['port'])))

        service_handle = gateway.getService(service)
        try:
            r = service_handle(*args)
            if r == '':
                print 'amf empty result', url, service, args
                ERR('amf empty result', url, service, args)
                continue

            break
        except:
            print 'amf failure', url, service, args, traceback.format_exc()
            ERR('amf failure', url, service, args, traceback.format_exc()) 

    if r == None:
        ERR(' *************** retry count exceeded', url, service, args)

    return r
开发者ID:beefjerky,项目名称:LightStormCrawler,代码行数:33,代码来源:page.py

示例2: findMediaById

# 需要导入模块: from pyamf.remoting.client import RemotingService [as 别名]
# 或者: from pyamf.remoting.client.RemotingService import setProxy [as 别名]
 def findMediaById(self, playerId, videoPlayer, publisherId, userAgent, amfVersion = pyamf.AMF3, **kwargs):
     client = RemotingService(self._amfUrl, user_agent = userAgent, amf_version = amfVersion)
     for k, v in kwargs.iteritems():
         if k == 'headers':
             for header in v:
                 client.addHTTPHeader(header[0], header[1])
         if k == 'proxy':
             client.setProxy(v)
     service = client.getService(self._serviceName)
     return service.findMediaById(self._token, playerId, videoPlayer, publisherId)
开发者ID:Jessicaaaaaa,项目名称:todits-xbmc,代码行数:12,代码来源:brightcove.py

示例3: getBrightCoveData

# 需要导入模块: from pyamf.remoting.client import RemotingService [as 别名]
# 或者: from pyamf.remoting.client.RemotingService import setProxy [as 别名]
 def getBrightCoveData(self, playerId, userAgent, amfVersion = pyamf.AMF3, **kwargs):
     client = RemotingService(self._amfUrl, user_agent = userAgent, amf_version = amfVersion)
     for k, v in kwargs.iteritems():
         if k == 'headers':
             for header in v:
                 client.addHTTPHeader(header[0], header[1])
         if k == 'proxy':
             client.setProxy(v)
     service = client.getService(self._serviceName)
     return service.getProgrammingForExperience(self._token, playerId)
开发者ID:Jessicaaaaaa,项目名称:todits-xbmc,代码行数:12,代码来源:brightcove.py

示例4: get_clip_info

# 需要导入模块: from pyamf.remoting.client import RemotingService [as 别名]
# 或者: from pyamf.remoting.client.RemotingService import setProxy [as 别名]
 def get_clip_info(self, contentID, url):
  serviceUrl = "http://c.brightcove.com/services/messagebroker/amf?playerId=" + self.urls['playerID']
  serviceName = "com.brightcove.experience.ExperienceRuntimeFacade"
  proxy = Proxy()
  client = RemotingService(serviceUrl, amf_version=3,
                           user_agent=webpage().fullagent('chrome'))
  client.setProxy(proxy.httpProxyString, type='http')
  service = client.getService(serviceName)

  pyamf.register_class(ViewerExperienceRequest,
                       'com.brightcove.experience.ViewerExperienceRequest')
  pyamf.register_class(ContentOverride,
                       'com.brightcove.experience.ContentOverride')

  content_override = ContentOverride(contentId=float("nan"),
                                     contentRefId=str(contentID))
  viewer_exp_req = ViewerExperienceRequest(url, [content_override],
                                           int(self.urls['playerID']), "")

  response = service.getDataForExperience(self.urls['const'], viewer_exp_req)

  #self._printResponse(response)
  return response['programmedContent']['videoPlayer']['mediaDTO']['renditions']
开发者ID:Beirdo,项目名称:plugin.video.nz.ondemand,代码行数:25,代码来源:tvnz.py


注:本文中的pyamf.remoting.client.RemotingService.setProxy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。