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


Python wamp.ApplicationSession类代码示例

本文整理汇总了Python中autobahn.asyncio.wamp.ApplicationSession的典型用法代码示例。如果您正苦于以下问题:Python ApplicationSession类的具体用法?Python ApplicationSession怎么用?Python ApplicationSession使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __init__

    def __init__(self, config=None):
        ApplicationSession.__init__(self, config)
        QMainWindow.__init__(self)
        self.bla = "hh"

        self.the_widget = MainWidget(parent=self)
        self.statusBar()
        self.main_window_init()
开发者ID:icefo,项目名称:PyQt5-Wamp,代码行数:8,代码来源:PyQt5_GUI.py

示例2: __init__

    def __init__(self, client_type, info_topic, realm_name):
        self.info_topic = info_topic
        self.client_type = client_type
        self.realm_name = realm_name
        self.loop = None

        cfg = ComponentConfig(self.realm_name, {})
        ApplicationSession.__init__(self, cfg)
开发者ID:cleberzavadniak,项目名称:eolo-wamp,代码行数:8,代码来源:__init__.py

示例3: __init__

 def __init__(self,realm, user, token, update_handler, ready_cb, close_cb, loop):
     ApplicationSession.__init__(self, config=ComponentConfig(realm=realm))
     self.user = user
     self.token = token
     self._on_update = update_handler
     self._on_ready = ready_cb
     self._on_closed = close_cb
     self.loop = loop
开发者ID:izderadicka,项目名称:asexor,代码行数:8,代码来源:wamp_client.py

示例4: __init__

 def __init__(self, x, server_id, database, ignore_development=False, simdata_path='/tmp'):
     self.server_id = server_id
     self._component = GoSmartSimulationServerComponent(
         server_id,
         database,
         self.publish,
         ignore_development=ignore_development,
         simdata_path=simdata_path
     )
     ApplicationSession.__init__(self, x)
开发者ID:philtweir,项目名称:glossia,代码行数:10,代码来源:session.py

示例5: __init__

    def __init__(self, config=None):
        self.log.info("initializing component: {config}", config=config)
        ApplicationSession.__init__(self, config)

        # load the client private key (raw format)
        try:
            self._key = cryptosign.SigningKey.from_raw_key(config.extra[u'key'])
        except Exception as e:
            self.log.error("could not load client private key: {log_failure}", log_failure=e)
            self.leave()
        else:
            self.log.info("client public key loaded: {}".format(self._key.public_key()))
开发者ID:crossbario,项目名称:crossbarexamples,代码行数:12,代码来源:client_raw_key_aio.py

示例6: __init__

    def __init__(self, x, gssa_file, subdirectory, output_files, tmp_transferrer='/tmp', input_files=None, definition_files=None, skip_clean=False, server=None):
        ApplicationSession.__init__(self, x)
        self._gssa = lxml.etree.parse(gssa_file)
        self._definition_files = definition_files
        self._input_files = input_files
        self._server = server
        self._tmp_transferrer = tmp_transferrer

        # We tar the definition files into one object for transferring and add
        # it to the definition node
        if self._definition_files is not None:
            self._definition_tmp = tempfile.NamedTemporaryFile(suffix='.tar.gz', dir=self._tmp_transferrer)
            definition_tar = tarfile.open(fileobj=self._definition_tmp, mode='w:gz')
            for definition_file in self._definition_files:
                definition_tar.add(definition_file, os.path.basename(definition_file))
                logger.debug("Added [%s]" % os.path.basename(definition_file))
            definition_tar.close()
            self._definition_tmp.flush()

            # Note that this makes the file global readable - we assume the
            # parent of the tmp directory is used to control permissions
            os.chmod(self._definition_tmp.name, stat.S_IROTH | stat.S_IRGRP | stat.S_IRUSR)

            logger.debug("Made temporary tar at %s" % self._definition_tmp.name)
            definition_node = self._gssa.find('.//definition')
            location_remote = os.path.join('/tmp', 'gssa-transferrer', os.path.basename(self._definition_tmp.name))
            definition_node.set('location', location_remote)

        # Do the same with the input surfaces
        if self._input_files is not None:
            self._input_tmp = tempfile.NamedTemporaryFile(suffix='.tar.gz', dir=self._tmp_transferrer)
            input_tar = tarfile.open(fileobj=self._input_tmp, mode='w:gz')
            for input_file in self._input_files:
                input_tar.add(input_file, os.path.basename(input_file))
                logger.debug("Added [%s]" % os.path.basename(input_file))
            input_tar.close()
            self._input_tmp.flush()

            # Note that this makes the file global readable - we assume the
            # parent of the tmp directory is used to control permissions
            os.chmod(self._input_tmp.name, stat.S_IROTH | stat.S_IRGRP | stat.S_IRUSR)

            logger.debug("Made temporary tar at %s" % self._input_tmp.name)
            input_node = lxml.etree.SubElement(self._gssa.find('.//transferrer'), 'input')
            location_remote = os.path.join('/tmp', 'gssa-transferrer', os.path.basename(self._input_tmp.name))
            input_node.set('location', location_remote)

        # Generate a simulation ID
        self._guid = uuid.uuid1()
        self._subdirectory = subdirectory
        self._output_files = output_files
        self._skip_clean = skip_clean
开发者ID:philtweir,项目名称:glossia,代码行数:52,代码来源:client.py

示例7: WampBase

class WampBase(object):
    '''Base class for websocket streaming
    '''
    def __init__(self,con):
        ''':param web.rest.base.Connection con: the base http connection
        '''
        self.conn    = con
        self.runner  = None
        self.url     = None
        self.loop    = None
        self.session = None
        self.th      = None

    def connect(self,url,realm):
        '''connect to websocket
           :param str url: url to which connect
        '''
        self.url = url
        if self.conn.id is None:
            self.conn.login()

        self.th = Thread(target=self.__f)
        self.runner = ApplicationRunner(url=url, ssl=True, realm=realm, headers={'cookie':'sessionid=%s' % self.conn.id})
        self.loop = asyncio.get_event_loop()
        self.session = ApplicationSession()
        coro = self.runner.run(self.session,start_loop = False)
        (self.__transport, self.__protocol) = self.loop.run_until_complete(coro)
        self.th.start()

    def subscribe(self,callback,topic):
        if self.session is None:
            raise RuntimeError('no Connection active')
        return self.session.subscribe(callback,topic)


    def leave(self):
        if self.session is not None:
            self.session.leave()
            self.stop()

    def stop(self):
        if self.loop is not None:
            self.loop.stop()
            self.loop = None

    def __f(self):
        #asyncio.set_event_loop(self.loop)
        self.loop.run_forever()
开发者ID:lspestrip,项目名称:striptease,代码行数:48,代码来源:base.py

示例8: __init__

    def __init__(self, x, responses, action, actor, debug, server=None, **kwargs):
        ApplicationSession.__init__(self, x)
        self._kwargs = kwargs
        self._action = action
        self._server = server
        self._responses = responses

        self._actor = actor
        self._actor.set_make_call(self.execute_call)
        self._actor.set_log(self.log)

        self._apis = {}

        if debug:
            # Seemingly the start_logging call is insufficient
            self.log._set_level('trace')
        if server or debug:
            logger.info("Targeting server [%s]" % (server))
开发者ID:go-smart,项目名称:glot,代码行数:18,代码来源:connector.py

示例9: subscribe

    def subscribe(self, callback, topic_name, options):
        opts = {'details_arg': 'details'}
        opts.update(options)

        yield from ApplicationSession.subscribe(
            self,
            callback,
            topic_name,
            protocol.types.SubscribeOptions(**opts))
开发者ID:cleberzavadniak,项目名称:eolo-wamp,代码行数:9,代码来源:__init__.py

示例10: connect

    def connect(self,url,realm):
        '''connect to websocket
           :param str url: url to which connect
        '''
        self.url = url
        if self.conn.id is None:
            self.conn.login()

        self.th = Thread(target=self.__f)
        self.runner = ApplicationRunner(url=url, ssl=True, realm=realm, headers={'cookie':'sessionid=%s' % self.conn.id})
        self.loop = asyncio.get_event_loop()
        self.session = ApplicationSession()
        coro = self.runner.run(self.session,start_loop = False)
        (self.__transport, self.__protocol) = self.loop.run_until_complete(coro)
        self.th.start()
开发者ID:lspestrip,项目名称:striptease,代码行数:15,代码来源:base.py

示例11: __init__

 def __init__(self, config=None):
     ApplicationSession.__init__(self, config)
     print("component created")
     self.q = self.config.extra['commqueue']
     self.tasks = []
开发者ID:potens1,项目名称:solar,代码行数:5,代码来源:sendreadings3.py

示例12: __init__

 def __init__(self, config):
     ApplicationSession.__init__(self, config)
     self.count = 0
开发者ID:Anggi-Permana-Harianja,项目名称:autobahn-python,代码行数:3,代码来源:frontend.py

示例13: __init__

 def __init__(self, config=None):
     ApplicationSession.__init__(self, config)
     print("component created")
开发者ID:potens1,项目名称:solar,代码行数:3,代码来源:sendreadings.py


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