本文整理汇总了Python中pyamf.remoting.client.RemotingService.getService方法的典型用法代码示例。如果您正苦于以下问题:Python RemotingService.getService方法的具体用法?Python RemotingService.getService怎么用?Python RemotingService.getService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyamf.remoting.client.RemotingService
的用法示例。
在下文中一共展示了RemotingService.getService方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pyamf.remoting.client import RemotingService [as 别名]
# 或者: from pyamf.remoting.client.RemotingService import getService [as 别名]
class mobileservices:
#Initialize this class
def __init__(self,acc,settingsmanager):
self.usemobileservices = settingsmanager.getvalue("Settings","usemobileservices")
if self.usemobileservices == 'on':
self.acc = acc
self.pyamfhandler = RemotingService('http://www.neopets.com/amfphp/gateway.php')
self.pyamfhandler.opener =self.acc.opener.open
self.token = self.domobilelogin()
print "Mobile login token = " + str(self.token)
def getnp(self):
#Get Np on hand
MobileService = self.pyamfhandler.getService('MobileService')
html = MobileService.getUser(self.acc.user,self.token)
thenp = html['neopoints']
return thenp
def domobilelogin(self):
#print self.acc.user
#print self.acc.pw
print "Performing mobile auth"
MobileService = self.pyamfhandler.getService('MobileService')
html = MobileService.auth(self.acc.user,self.acc.pw)
#print html
self.activepetname =html['user']['active_pet']
return html['token']
def setactivepet(self,petname):
PetService = self.pyamfhandler.getService('PetService')
#activepetname
html = PetService.setActivePet(petname,self.acc.user,self.token)
return html
def getpetlist(self):
MobileService = self.pyamfhandler.getService('MobileService')
html = MobileService.getPets(self.acc.user,self.token)
return html
示例2: _connect
# 需要导入模块: from pyamf.remoting.client import RemotingService [as 别名]
# 或者: from pyamf.remoting.client.RemotingService import getService [as 别名]
def _connect(self):
success = False
try:
self._check_host_url()
client = RemotingService(self._host_url)
self.dlg = ProgressDialog("Connecting to Cluster...", None, 0, 0, self)
func = lambda: client.getService('clustercontrol')
self.dlg.exec_(func)
self._service = self.dlg.getTargetResult()
self._check_api_version()
except ConnectionError as e:
msg = ("%s\nDo you want to turn off the cluster support?") %str(e)
ret = QMessageBox.question(
self, "Error", msg)
if ret == QMessageBox.Yes:
self._turn_off_cluster_support()
except Exception as e:
QMessageBox.critical(self, "Error", str(e))
else:
try:
self.dlg.exec_(self._service.get_cecog_versions)
cluster_versions = self.dlg.getTargetResult()
except Exception as e:
QMessageBox.critical(self, "Error", str(e))
else:
if not version in set(cluster_versions):
QMessageBox.warning(
self, "Warning",
("Cluster does not support %s %s"
"Available versions: %s"
%(appname, version, ', '.join(cluster_versions))))
else:
success = True
return success
示例3: handle
# 需要导入模块: from pyamf.remoting.client import RemotingService [as 别名]
# 或者: from pyamf.remoting.client.RemotingService import getService [as 别名]
def handle(self, *args, **options):
url = "http://%s:%d/gateway" % (settings.HOST_INFO[0], settings.HOST_INFO[1])
client = RemotingService(url, logger=logging)
print "Client running - pointing to server at %s" % url
# import ipdb; ipdb.set_trace()
user_service = client.getService("user")
map_service = client.getService("map")
testerA = user_service.put_user("tester1", "test", "[email protected]")
testerB = user_service.get_user("tester1")
map = map_service.put_map("tester1", "test map 1", datetime.datetime.now(), "test data", 1, False)
map_1 = map_service.get_map("tester1", map["id"])
示例4: AboutTestCase
# 需要导入模块: from pyamf.remoting.client import RemotingService [as 别名]
# 或者: from pyamf.remoting.client.RemotingService import getService [as 别名]
class AboutTestCase(unittest.TestCase):
def setUp(self):
self.gw = RemotingService('http://localhost:8000%s' % reverse('gateway'))
self.service = self.gw.getService('about')
def testGatewayContact(self):
self.service.contact('hello', '[email protected]', 'test contact', 'test contact')
示例5: _connect
# 需要导入模块: from pyamf.remoting.client import RemotingService [as 别名]
# 或者: from pyamf.remoting.client.RemotingService import getService [as 别名]
def _connect(self):
self._check_host_url()
success = False
msg = 'Error on connecting to cluster control service on %s' % self._host_url
try:
client = RemotingService(self._host_url)
self.dlg = ProgressDialog("connecting to cluster...", None, 0, 0, self)
func = lambda: client.getService('clustercontrol')
self.dlg.exec_(func)
self._service = self.dlg.getTargetResult()
except:
exception(self, msg)
else:
try:
self.dlg.exec_(self._service.get_cecog_versions)
cluster_versions = self.dlg.getTargetResult()
except Exception as e:
exception(self, msg + '(%s)' %str(e))
else:
if not VERSION in set(cluster_versions):
warning(self, 'Cecog version %s not supported by the cluster' %
VERSION, 'Valid versions are: %s' \
% ', '.join(cluster_versions))
else:
success = True
return success
示例6: IssueTestCase
# 需要导入模块: from pyamf.remoting.client import RemotingService [as 别名]
# 或者: from pyamf.remoting.client.RemotingService import getService [as 别名]
class IssueTestCase(unittest.TestCase):
def setUp(self):
self.gw = RemotingService('http://localhost:8000%s' % reverse('gateway'))
self.service = self.gw.getService('account')
def testGatewayLogin(self):
values = self.service.login("thoas", "toto")
示例7: _resolve_rtmp_playback_url_via_flash
# 需要导入模块: from pyamf.remoting.client import RemotingService [as 别名]
# 或者: from pyamf.remoting.client.RemotingService import getService [as 别名]
def _resolve_rtmp_playback_url_via_flash(self, key):
self._addon.log_notice("Resolving rtmp playback url for %s using flash" % key)
user_agent = getUserAgent()
self._addon.log_notice("Using user agent '%s'" % user_agent)
svc = RemotingService(self._AMF_ENDPOINT, amf_version = 0, user_agent = user_agent)
svc.addHTTPHeader('Cookie', 'r=' + self._state['rdio_cookie'])
svc.addHTTPHeader('Host', 'www.rdio.com')
rdio_svc = svc.getService('rdio')
playback_token = self._state['playback_token']
secret_string = key + playback_token + self._RDIO_PLAYBACK_SECRET
secret = self._RDIO_PLAYBACK_SECRET_SEED
for c in secret_string:
secret = ((secret << 5) + secret + ord(c)) % 65536;
playerName = 'api_%s' % str(int(math.floor(random.random() * 1000000)))
pi = rdio_svc.getPlaybackInfo({
'domain': self._RDIO_DOMAIN,
'playbackToken': playback_token,
'manualPlay': False,
'requiresUnlimited': False,
'playerName': playerName,
'type': 'flash',
'secret': secret,
'key': key})
if not pi:
raise Exception, 'Failed to get playback info'
return self._extract_rtmp_url_from_playback_info(pi)
示例8: get_amf
# 需要导入模块: from pyamf.remoting.client import RemotingService [as 别名]
# 或者: from pyamf.remoting.client.RemotingService import getService [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
示例9: __init__
# 需要导入模块: from pyamf.remoting.client import RemotingService [as 别名]
# 或者: from pyamf.remoting.client.RemotingService import getService [as 别名]
def __init__( self ):
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)-5.5s [%(name)s] %(message)s')
params = self._parse_argv()
pDialog = xbmcgui.DialogProgress()
pDialog.create('NBC Video Player', 'Getting Episode ID')
pDialog.update(5)
#Download the page required
pageUrl = self.BASE_URL + unquote_plus(params['episodeUrl'])
source = self._fetch_url(pageUrl)
pDialog.update(30)
# Extact the ID numbers from the page
vidId= re.search('var\s*assetId\s*=\s*\'?([0-9]+)\'?;',source).group(1)
pDialog.create('NBC Video Player', 'Retrieving Episode URL')
pDialog.update(40)
# Connect to the AMF service
client = RemotingService(self.AMF_URL,amf_version=1,logger=logging)
# Make the request
response = client.getService('getClipInfo.getClipAll')(vidId,'US','632','-1')
pDialog.update(50)
# Retrieve SMIL
smil = self._fetch_url(self.SMIL_URL % response['clipurl'])
file = re.search('<video src="(.+?)"',smil).group(1)
pDialog.update(60)
pDialog.create('NBC Video Player', 'Getting NBC Video Player Configuration')
# Retrieve video config
config = client.getService('getConfigInfo.getConfigAll')(self.CONFIG_ID)
pDialog.update(75)
pDialog.create('NBC Video Player', 'Connecting to RTMP Server')
# Generate the RMPT(e) Url
rtmp_url = "rtmp://%s/%s playpath=%s swfUrl=%s swfVfy=1" % (config['akamaiHostName'], config['akamaiAppName'], file.replace('.flv',''),self.SWF_URL)
print 'rtmpdump -r "rtmp://%s/%s" -y "%s" -W "%s" -o "%s"' % (config['akamaiHostName'], config['akamaiAppName'], file.replace('.flv',''),self.SWF_URL,'video.flv')
# Play the url
listitem = xbmcgui.ListItem(response['metadata']['title'])
listitem.setInfo("video",{'title':response['metadata']['title'],'tvshowtitle':response['metadata']['show'],'plot':response['metadata']['description'],'date':response['metadata']['publishdate'],'season':int(params['season']),'episode':int(params['episode']),'studio':'NBC'})
listitem.setThumbnailImage(self.SMIL_URL % response['metadata']['imageurl'])
xbmc.Player(xbmc.PLAYER_CORE_AUTO).play(rtmp_url, listitem)
示例10: main
# 需要导入模块: from pyamf.remoting.client import RemotingService [as 别名]
# 或者: from pyamf.remoting.client.RemotingService import getService [as 别名]
def main():
"""
Entry point for this client script.
"""
url = 'http://%s:%d' % (host_info[0], host_info[1])
client = RemotingService(url, logger=logging)
print "Client running - pointing to server at %s" % url
# at this point, calling the service gets us a dict of values
user_service = client.getService('user')
lenards = user_service.get_user('lenards')
# in case you don't believe me - this shows I'm not lying
logging.debug("isinstance(lenards, dict): %s" % isinstance(lenards, dict))
# the User class attributes are not present at this point
logging.debug("not hasattr(lenards, 'username'): %s" %
(not hasattr(lenards, 'username')))
logging.debug("not hasattr(lenards, 'email'): %s" %
(not hasattr(lenards, 'email')))
logging.debug("not hasattr(lenards, 'password'): %s" %
(not hasattr(lenards, 'password')))
# but the values are there
logging.debug("lenards['username'] == 'lenards': %s" %
(lenards['username'] == 'lenards'))
logging.debug("lenards['email'] == '[email protected]': %s" %
(lenards['email'] == '[email protected]'))
logging.debug("Output 'lenards': %s" % lenards)
# if we register the class and the namespace, we get an object ref
# (complete with attributes and such)
logging.debug("Register UserDataTransferObject class...")
pyamf.register_class(UserDataTransferObject, '%s.User' % AMF_NAMESPACE)
logging.debug("Get a user from the server...")
usr = user_service.get_user('lisa')
# ensure it's the class we expect
logging.debug("Ensure the class we got is our DTO, " +
"isinstance(usr, UserDataTransferObject): %s" %
isinstance(usr, UserDataTransferObject))
# verify it has expected attributes
logging.debug("Verify attributes present...")
logging.debug("usr.username: %s" % usr.username)
logging.debug("usr.email == '[email protected]': %s" %
(usr.email == '[email protected]'))
logging.debug("usr.password == 'h1k3r': %s" %
(usr.password == 'h1k3r'))
logging.debug("Output user returned: %s" % usr)
# request an unknown user
logging.debug("Try to get a user that does not exist...")
george = user_service.get_user('george')
logging.debug("Output returned: %s" % george)
示例11: get_episode_url
# 需要导入模块: from pyamf.remoting.client import RemotingService [as 别名]
# 或者: from pyamf.remoting.client.RemotingService import getService [as 别名]
def get_episode_url(self,url,Id):
client = RemotingService(url)
vi = client.getService('Nrj_VideoInfos')
mi = vi.mediaInfo(Id)
if self.debug_mode:
print "url_episode : "+mi["url"]
url_episode = mi["url"]
return url_episode
示例12: get_url
# 需要导入模块: from pyamf.remoting.client import RemotingService [as 别名]
# 或者: from pyamf.remoting.client.RemotingService import getService [as 别名]
def get_url(url, mediaId):
"appel à pyamf pour l'adresse de la vidéo"
client = RemotingService(url)
vi = client.getService('Nrj_VideoInfos')
mi = vi.mediaInfo(mediaId)
url_episode = mi["url"]
titre = mi["title"].replace(' ','_')
return url_episode, titre
示例13: getAmfInfo
# 需要导入模块: from pyamf.remoting.client import RemotingService [as 别名]
# 或者: from pyamf.remoting.client.RemotingService import getService [as 别名]
def getAmfInfo(url, userAgent, serviceName, methodName):
import pyamf
from pyamf.remoting.client import RemotingService
from pyamf import remoting, amf3, util
client = RemotingService(url, user_agent = userAgent)
service = client.getService(serviceName)
methodCall = getattr(service, methodName)
return service.methodCall()
示例14: get_url
# 需要导入模块: from pyamf.remoting.client import RemotingService [as 别名]
# 或者: from pyamf.remoting.client.RemotingService import getService [as 别名]
def get_url(video_id):
utils.log("Fetching video URL for content ID %s..." % video_id)
client = RemotingService('http://nrl.bigpondvideo.com/App/AmfPhp/gateway.php')
service = client.getService('SEOPlayer')
base_url = service.getMediaURL({'cid': video_id})
base_url = get_javascript_url(base_url)
utils.log("Base URL found: %s" % base_url)
return base_url
示例15: getactivepet
# 需要导入模块: from pyamf.remoting.client import RemotingService [as 别名]
# 或者: from pyamf.remoting.client.RemotingService import getService [as 别名]
class nomobileservices:
def getactivepet(self):
CustomPetService = self.pyamfhandler.getService('CustomPetService')
html = CustomPetService.getUserData(self.acc.user)
return html['active_pet']
def __init__(self,acc,settingsmanager):
self.acc = acc
self.pyamfhandler = RemotingService('http://www.neopets.com/amfphp/gateway.php')
self.pyamfhandler.opener =self.acc.opener.open
self.activepetname =self.getactivepet()
def getnp(self):
#Get Np on hand
retnp = 0
temphtml = self.acc.get('http://www.neopets.com/objects.phtml')
if temphtml.find("id='npanchor") > 1:
startpos = temphtml.find("id='npanchor")
startpos2 = self.acc.cleanhtml.find("'>",startpos) +2
endpos = temphtml.find('</a>',startpos2)
tempnp = temphtml[startpos2:endpos]
tempnp = tempnp.replace(',','')
retnp =tempnp
return retnp
def getpetlist(self):
PetService = self.pyamfhandler.getService('PetService')
html = PetService.getAllPets(self.acc.user)
return html
def setactivepet(self,petname):
html = self.acc.get('http://www.neopets.com/process_changepet.phtml?new_active_pet=' + petname,'http://www.neopets.com/quickref.phtml')