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
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
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
def getData(): global data client = RemotingService('http://dracula.irq.ru/Gateway.aspx') service = client.getService('MafiaAMF.AMFService') params1 = { "userId": "124520", "ServerVersion": sid, "SystemID": "1", "sig": "d6b9ab24005cf6447de56d505f09b9a9" } resp = service.dispatch(params1, "AMFService.ClanFightInfoGet", [{ "BattleDBID": bid, "IsArchive": False }], False) if resp.has_key("data"): data = resp["data"] if data.has_key("Answer"): data = data["Answer"] if data.has_key("OtherData"): data = data["OtherData"] if data.has_key("ClanFightInfo"): data = data["ClanFightInfo"] if data != {}: changeInfo("ActorPlayers") changeInfo("TargetPlayers")
def getData(acrch=False): data = {} client = RemotingService('http://dracula.irq.ru/Gateway.aspx') service = client.getService('MafiaAMF.AMFService') params1 = { "userId": "124520", "ServerVersion": 11522, "SystemID": "1", "sig": "d6b9ab24005cf6447de56d505f09b9a9" } resp = service.dispatch(params1, "AMFService.ClanFightInfoGet", [{ "BattleDBID": bid, "IsArchive": acrch }], False) to_end = False if resp.has_key("data"): data = resp["data"] if data.has_key("Answer"): data = data["Answer"] if data.has_key("OtherData"): data = data["OtherData"] if data.has_key("ClanFightInfo"): data = data["ClanFightInfo"] to_end = True return data, to_end
def getClanData(): data = [] client = RemotingService('http://dracula.irq.ru/Gateway.aspx') service = client.getService('MafiaAMF.AMFService') params1 = { "userId": "124520", "ServerVersion": sid, "SystemID": "1", "sig": "d6b9ab24005cf6447de56d505f09b9a9" } resp = service.dispatch(params1, "AMFService.ClanInfoGet", [{ "ClanDBID": cid }], False) name = 'none' if resp.has_key("data"): data = resp["data"] if data.has_key("Answer"): data = data["Answer"] if data.has_key("OtherData"): data = data["OtherData"] if data.has_key("PublicClanInfo"): data = data["PublicClanInfo"] name = data["Name"] if data.has_key("ClanUsers"): data = data["ClanUsers"] return name, data
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
def get_videos(channel_id): videos = [] client = RemotingService( 'http://nrl.bigpondvideo.com/App/AmfPhp/gateway.php') service = client.getService('Miscellaneous') params = { 'navId': channel_id, 'startRecord': '0', 'howMany': '50', 'platformId': '1', 'phpFunction': 'getClipList', 'asFunction': 'publishClipList' } videos_list = service.getClipList(params) if videos_list: for video_item in videos_list[0]['items']: video = parse_video(video_item) videos.append(video) return videos else: d = xbmcgui.Dialog() msg = utils.dialog_message("Video list returned no results.") d.ok(*msg) return
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
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'] == '*****@*****.**': %s" % (lenards['email'] == '*****@*****.**')) 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 == '*****@*****.**': %s" % (usr.email == '*****@*****.**')) 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)
def __init__(self, acc, settingsmanager): self.settingsmanager = settingsmanager self.loadsettings() self.acc = acc self.pyamfhandler = RemotingService( 'http://www.neopets.com/amfphp/gateway.php') self.pyamfhandler.opener = self.acc.opener.open self.loghandler = logwriter(acc, settingsmanager)
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
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
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()
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
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()
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 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
def test_gateway(): logging.basicConfig( level=logging.DEBUG, format='%(asctime)s %(levelname)-5.5s [%(name)s] %(message)s' ) gw = RemotingService('http://127.0.0.1:8000/interactivity/', logger=logging) service = gw.getService('interactivity') print service.loadClientConfig()
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
def hello(request): logging.basicConfig( level=logging.DEBUG, format='%(asctime)s %(levelname)-5.5s [%(name)s] %(message)s' ) gw = RemotingService('http://127.0.0.1:8000/interactivity/', logger=logging) service = gw.getService('interactivity') output = service.hello() #print output return render(request, 'interactivity/hello.html', locals())
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 main(host): gw = RemotingService('http://%s/gateway' % host) service = gw.getService('grocery') for store in loaddata.stores: service.create('RetailStore', dict(name=store)) for key in loaddata.sections.keys(): id = service.create('StoreSection', dict(name=key)) for item in loaddata.sections[key]: service.create('ItemDescription', dict(store_section=id, description=item[0], is_default=item[1]))
def process_channel(channel_id, tags): client = RemotingService('http://afl.bigpondvideo.com/App/AmfPhp/gateway.php') service = client.getService('Miscellaneous') params = {'navId':channel_id, 'startRecord':'0', 'howMany':'15', 'platformId':'1', 'phpFunction':'getClipList', 'asFunction':'publishClipList'} videos_list = get_service_data(service, 'getClipList', params) if videos_list: for video_item in videos_list[0]['items']: try: parse_video(video_item['content'], tags) except: logging.error("Error parsing video: %s\n%s" % (video_item['content']['contentId'], sys.exc_info()[:2]))
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
def getsmil(vid): gw = RemotingService(url='http://video.nbcuni.com/amfphp/gateway.php', referer='http://www.nbc.com/assets/video/3-0/swf/NBCVideoApp.swf', user_agent='Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7)', ) ClipAll_service = gw.getService('getClipInfo.getClipAll') geo ="US" num1 = "632" num2 = "-1" response = ClipAll_service(vid,geo,num1,num2) url = 'http://video.nbcuni.com/' + response['clipurl'] return url
def exportToICal(self, event_id): from pyamf.remoting.client import RemotingService # @UnresolvedImport from icalendar import Calendar, Event, vDatetime # @UnresolvedImport import uuid, os client = RemotingService(self.application.app_settings["url"]+"/"+self.application.app_config["connection"]["npi_service"]) service = client.getService("default") events = service.loadTable_amf(self.getCredentials(), "models.event", "id="+str(event_id), None) if events.__class__.__name__!="ArrayCollection": wx.MessageBox(str(events), "saveDataSet", wx.OK | wx.ICON_ERROR) return elif len(events)>0: event = events[0] cal = Calendar() cal.add('prodid', '-//nervatura.com/NONSGML Nervatura Calendar//EN') cal.add('version', '2.0') clevent = Event() if event["uid"]!=None: clevent['uid'] = event["uid"] else: clevent['uid'] = uuid.uuid4() if event["fromdate"]!=None: clevent['dtstart'] = vDatetime(event["fromdate"]).ical() if event["todate"]!=None: clevent['dtend'] = vDatetime(event["todate"]).ical() if event["subject"]!=None: clevent['summary'] = event["subject"] if event["place"]!=None: clevent['location'] = event["place"] if event["eventgroup"]!=None: groups = service.loadTable_amf(self.getCredentials(), "models.groups", "id="+str(event["eventgroup"]), None) if groups.__class__.__name__=="ArrayCollection": if len(groups)>0: clevent['category'] = groups[0].groupvalue if event["description"]!=None: clevent['description'] = event["description"] cal.add_component(clevent) wildcard = "iCal files (*.ical)|" \ "All files (*.*)|*.*" dlg = wx.FileDialog( self, message="Event export", defaultDir=(os.getenv('USERPROFILE') or os.getenv('HOME')), defaultFile=str(event["calnumber"]).replace("/", "_"), wildcard=wildcard, style=wx.SAVE) dlg.SetFilterIndex(0) if dlg.ShowModal() == wx.ID_OK: icalfile = open(dlg.GetPath()+".ical", 'w') icalfile.write(cal.as_string()) icalfile.close() dlg.Destroy()
def test_gateway_available(self): ''' Tests to make sure we can connect to the gateway ''' logging.basicConfig( level=logging.DEBUG, format='%(asctime)s %(levelname)-5.5s [%(name)s] %(message)s' ) gw = RemotingService('http://127.0.0.1:8000/interactivity/', logger=logging) service = gw.getService('interactivity') output = service.hello() #print output self.assertEqual(1,1)
def task_request(obj, domain, method): if method == 'register': try: gw = RemotingService(domain+'sync/', amf_version=AMF3) service = gw.getService('SyncService') http_data = service.register(obj) return http_data except Exception, e: # set the admin phone nos as global variable in the settings and make message_as_sms() loop over the nos. data = {'subject': 'Offline Registration Error', 'message': e, 'phone': '08137474080'} message_as_email(data) return
def getBattlesData(): data = [] client = RemotingService('http://dracula.irq.ru/Gateway.aspx') service = client.getService('MafiaAMF.AMFService') resp = service.dispatch(params1,"AMFService.ClanFightListGet",[{}],False) if resp.has_key("data"): data = resp["data"] if data.has_key("Answer"): data = data["Answer"] if data.has_key("OtherData"): data = data["OtherData"] if data.has_key("ClanWarsList"): data = data["ClanWarsList"] return data
def getrtmp(): #rtmpurl = 'rtmp://cp37307.edgefcs.net:443/ondemand' gw = RemotingService(url='http://video.nbcuni.com/amfphp/gateway.php', referer='http://video.nbcuni.com/embed/player_3-x/External.swf', user_agent='Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7)', ) ClipAll_service = gw.getService('getConfigInfo.getConfigAll') #Not sure where this number is coming from need to look further at action script. num1 = "19100" response = ClipAll_service(num1) rtmphost= response['akamaiHostName'] app = response['akamaiAppName'] rtmpurl = 'rtmp://'+rtmphost+':443/'+app return rtmpurl
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
def getClanList(): data = {} client = RemotingService('http://odnvamp.irq.ru/Gateway.aspx') service = client.getService('MafiaAMF.AMFService') resp = service.dispatch(params1,"AMFService.ClanListGet",[{"IsFight":False}],False) if resp.has_key("data"): data = resp["data"] if data.has_key("Answer"): data = data["Answer"] if data.has_key("OtherData"): data = data["OtherData"] if data.has_key("ClanList"): data = data["ClanList"] return data
def GetRemotingService(self, key, serviceName): #logger.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=logger, 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
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
def doVote(data): appReferer = "http://vodafone.egotribe.nl/WOD2010_Loader01.swf?random=" + str(random.randint(10000, 99999)) userAgent = "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.127 Safari/533.4" logging.basicConfig(level=logging.DEBUG, format="%(asctime)s %(levelname)-5.5s [%(name)s] %(message)s") try: gw = RemotingService( "http://flashservices.egotribe.nl/gateway.php", referer=appReferer, logger=logging, user_agent=userAgent ) gw.addHTTPHeader("Accept-encoding", "gzip") service = gw.getService("vodafoneGadget") print service.saveVote(data) except: pass
def getrtmpOLD(): gw = RemotingService(url='http://video.nbcuni.com/amfphp/gateway.php', referer='http://www.nbc.com/assets/video/3-0/swf/NBCVideoApp.swf', user_agent='Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7)', ) ClipAll_service = gw.getService('getConfigInfo.getConfigAll') num1 = "17010" response = ClipAll_service(num1) rtmphost= response['akamaiHostName'] app = response['akamaiAppName'] identurl = 'http://'+rtmphost+'/fcs/ident' ident = common.getURL(identurl) ip = re.compile('<fcs><ip>(.+?)</ip></fcs>').findall(ident)[0] rtmpurl = 'rtmp://'+ip+':1935/'+app+'?_fcs_vhost='+rtmphost return str(rtmpurl)
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", "*****@*****.**") 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"])
class AboutTestCase(unittest.TestCase): def setUp(self): self.gw = RemotingService('http://*****:*****@milkshape.cc', 'test contact', 'test contact')
def __init__(self,acc,settingsmanager): self.settingsmanager = settingsmanager self.loadsettings() self.acc = acc self.pyamfhandler = RemotingService('http://www.neopets.com/amfphp/gateway.php') self.pyamfhandler.opener =self.acc.opener.open self.loghandler = logwriter(acc,settingsmanager)
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")
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 = waitingProgressDialog('Please wait for the cluster...', self) self.dlg.setTarget(client.getService, 'clustercontrol') self.dlg.exec_() self._service = self.dlg.getTargetResult() except: exception(self, msg) else: try: self.dlg.setTarget(self._service.get_cecog_versions) self.dlg.exec_() cluster_versions = self.dlg.getTargetResult() except: exception(self, msg) 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
def getsmil(vid): gw = RemotingService(url='http://video.nbcuni.com/amfphp/gateway.php', referer='http://www.usanetwork.com/[[IMPORT]]/video.nbcuni.com/outlet/extensions/inext_video_player/video_player_extension.swf', user_agent='Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7)', ) ClipAll_service = gw.getService('getClipInfo.getClipAll') geo ="inside" num1 = "www.usanetwork.com" num2 = "-1" response = ClipAll_service(vid,geo,num1,num2) if 'errordis' in response.keys(): xbmcgui.Dialog().ok(xbmc.getLocalizedString(30005), xbmc.getLocalizedString(30005)) return else: url = 'http://video.nbcuni.com/' + response['clipurl'] return url
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)
def getServices(self): '''get game services''' client = RemotingService('http://xiaonei.paopaoyu.cn/gateway/') client.amf_version=0 client.client_type=3 client.strict=True client.request_number=self.id self.id+=1 client.addHTTPHeader('Referer',self.reffre) client.addHTTPHeader('Cookie:',self.cookie) client.user_agent="Mozilla-xx/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.1.3) Gecko/20090824 waigua" service = client.getService('gameService') return service
def getsmil(vid): gw = RemotingService(url='http://video.nbcuni.com/amfphp/gateway.php', referer='http://video.nbcuni.com/embed/player_3-x/External.swf', user_agent='Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7)', ) ClipAll_service = gw.getService('getClipInfo.getClipAll') geo ="US" num1 = " " #num2 = "-1" response = ClipAll_service(vid,geo,num1)#,num2) print response if 'errordis' in response.keys(): xbmcgui.Dialog().ok(xbmc.getLocalizedString(30005), xbmc.getLocalizedString(30005)) return else: url = 'http://video.nbcuni.com/' + response['clipurl'] return url
def getrtmpOLD(): gw = RemotingService( url='http://video.nbcuni.com/amfphp/gateway.php', referer='http://www.nbc.com/assets/video/3-0/swf/NBCVideoApp.swf', user_agent= 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7)', ) ClipAll_service = gw.getService('getConfigInfo.getConfigAll') num1 = "17010" response = ClipAll_service(num1) rtmphost = response['akamaiHostName'] app = response['akamaiAppName'] identurl = 'http://' + rtmphost + '/fcs/ident' ident = common.getURL(identurl) ip = re.compile('<fcs><ip>(.+?)</ip></fcs>').findall(ident)[0] rtmpurl = 'rtmp://' + ip + ':1935/' + app + '?_fcs_vhost=' + rtmphost return str(rtmpurl)
def getClanList(): data = {} client = RemotingService('http://odnvamp.irq.ru/Gateway.aspx') service = client.getService('MafiaAMF.AMFService') resp = service.dispatch(params1, "AMFService.ClanListGet", [{ "IsFight": False }], False) if resp.has_key("data"): data = resp["data"] if data.has_key("Answer"): data = data["Answer"] if data.has_key("OtherData"): data = data["OtherData"] if data.has_key("ClanList"): data = data["ClanList"] return data
def task_request(obj, domain, method): if method == 'register': try: gw = RemotingService(domain + 'sync/', amf_version=AMF3) service = gw.getService('SyncService') http_data = service.register(obj) return http_data except Exception, e: # set the admin phone nos as global variable in the settings and make message_as_sms() loop over the nos. data = { 'subject': 'Offline Registration Error', 'message': e, 'phone': '08137474080' } message_as_email(data) return
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')
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)
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', '*****@*****.**') 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'])
def getsmil(vid): gw = RemotingService( url='http://video.nbcuni.com/amfphp/gateway.php', referer= 'http://www.usanetwork.com/[[IMPORT]]/video.nbcuni.com/outlet/extensions/inext_video_player/video_player_extension.swf', user_agent= 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7)', ) ClipAll_service = gw.getService('getClipInfo.getClipAll') geo = "inside" num1 = "www.usanetwork.com" num2 = "-1" response = ClipAll_service(vid, geo, num1, num2) if 'errordis' in response.keys(): xbmcgui.Dialog().ok(xbmc.getLocalizedString(30005), xbmc.getLocalizedString(30005)) return else: url = 'http://video.nbcuni.com/' + response['clipurl'] return url
def getrtmp(): #rtmpurl = 'rtmp://8.18.43.101/ondemand?_fcs_vhost=cp35588.edgefcs.net' gw = RemotingService( url='http://video.nbcuni.com/amfphp/gateway.php', referer= 'http://www.usanetwork.com/[[IMPORT]]/video.nbcuni.com/outlet/extensions/inext_video_player/video_player_extension.swf', user_agent= 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7)', ) ClipAll_service = gw.getService('getConfigInfo.getConfigAll') #Not sure where this number is coming from need to look further at action script. num1 = "23012" response = ClipAll_service(num1) rtmphost = response['akamaiHostName'] app = response['akamaiAppName'] identurl = 'http://' + rtmphost + '/fcs/ident' ident = getHTML(identurl) ip = re.compile('<fcs><ip>(.+?)</ip></fcs>').findall(ident)[0] rtmpurl = 'rtmp://' + ip + '/' + app + '?_fcs_vhost=' + rtmphost return rtmpurl
def getClanData(): data = [] client = RemotingService('http://odnvamp.irq.ru/Gateway.aspx') service = client.getService('MafiaAMF.AMFService') resp = service.dispatch(params1, "AMFService.ClanInfoGet", [{ "ClanDBID": cid }], False) name = 'none' if resp.has_key("data"): data = resp["data"] if data.has_key("Answer"): data = data["Answer"] if data.has_key("OtherData"): data = data["OtherData"] if data.has_key("PublicClanInfo"): data = data["PublicClanInfo"] name = data["Name"] if data.has_key("ClanUsers"): data = data["ClanUsers"] return name, data
def __init__(self, service, url): if service == 'amf': self.service = service from pyamf.remoting.client import RemotingService self.svcGateway = RemotingService(url) elif service == 'xmlrpc': self.service = service from xmlrpclib import ServerProxy self.svcGateway = ServerProxy(url, allow_none=True) else: raise Exception, 'Valid services are "amf" and "xmlrpc"'