Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
print("Charlie")
details.progress("Charlie")
yield sleep(1)
returnValue("ok")
try:
yield self.register(longop, procedure2,
RegisterOptions(details_arg='details'))
print(procedure2, "registered")
except Exception as e:
print("could not register procedure: {0}".format(e))
if __name__ == '__main__':
runner = ApplicationRunner(url=u"ws://localhost:8080/ws", realm=realm)
runner.run(MyComponent)
print("Received", event_count, "events")
def main():
"""
Main function for enabling mdstudio_cli command line script functionality
"""
# Parse command line arguments
cliparser = lie_cli_parser()
# Connect to MDStudio and call method
runner = ApplicationRunner(u'ws://localhost:8080/ws', u'liestudio', extra=cliparser)
runner.run(CliWampApi, auto_reconnect=False, log_level='error')
arglengths = yield self.call(u'com.arguments.arglen', 1, 2, 3, a = 1, b = 2, c = 3)
print("Arglen 4: {}".format(arglengths))
self.leave()
def onDisconnect(self):
print("disconnected")
reactor.stop()
if __name__ == '__main__':
from autobahn.twisted.wamp import ApplicationRunner
runner = ApplicationRunner("ws://127.0.0.1:8080/ws", "realm1")
runner.run(Component)
print("Final: {}".format(res))
self.leave()
def onDisconnect(self):
print("disconnected")
reactor.stop()
if __name__ == '__main__':
import six
url = environ.get("AUTOBAHN_DEMO_ROUTER", u"ws://127.0.0.1:8080/ws")
if six.PY2 and type(url) == six.binary_type:
url = url.decode('utf8')
realm = u"crossbardemo"
runner = ApplicationRunner(url, realm)
runner.run(Component)
def start(self):
"""
Start the event loop
"""
logger.debug('starting event loop')
runner = ApplicationRunner(
url=self.config['transport_host'],
realm=u'realm1',
extra={'config': self.config, 'callback': self.callback}
)
runner.run(ConsumerApp)
return IRCComponent(config)
else:
# if no config given, return a description of this WAMPlet ..
return {'label': 'An IRC bot service component',
'description': 'This component provides IRC bot services via WAMP.'}
if __name__ == '__main__':
from autobahn.twisted.wamp import ApplicationRunner
extra = {
"server": "tcp:irc.freenode.net:6667"
}
# test drive the component during development ..
runner = ApplicationRunner(
url="ws://127.0.0.1:8080/ws",
realm="realm1",
extra=extra,
debug=False, # low-level WebSocket debugging
debug_wamp=False, # WAMP protocol-level debugging
debug_app=True) # app-level debugging
runner.run(make)
def onDisconnect(self):
print("disconnected")
reactor.stop()
if __name__ == '__main__':
import six
url = os.environ.get('CBURL', u'ws://localhost:8080/ws')
realm = os.environ.get('CBREALM', u'realm1')
# any extra info we want to forward to our ClientSession (in self.config.extra)
extra = {
u'foobar': u'A custom value'
}
runner = ApplicationRunner(url=url, realm=realm, extra=extra)
runner.run(ClientSession, auto_reconnect=True)
def resolve(result):
logger.debug('[CrochetReactor] callback resolve: %s' % result)
ready_deferred.callback(result)
return result
self._async_session.on_join_defer.addCallback(resolve)
def resolve_error(failure):
logger.debug('[CrochetReactor] errback resolve_error: %s' % failure)
ready_deferred.errback(failure)
self._async_session.on_join_defer.addErrback(resolve_error)
return self._async_session
self._async_runner = ApplicationRunner(**kwargs)
d = self._async_runner.run(register_session, start_reactor=False)
def connect_error(failure):
ready_deferred.errback(failure)
d.addErrback(connect_error)
logger.debug('[CrochetReactor] end bootstrap')
return ready_deferred
yield self.register(ping, u'com.arguments.ping')
yield self.register(add2, u'com.arguments.add2')
yield self.register(stars, u'com.arguments.stars')
yield self.register(orders, u'com.arguments.orders')
yield self.register(arglen, u'com.arguments.arglen')
print("Procedures registered; ready for frontend.")
if __name__ == '__main__':
import six
url = environ.get("AUTOBAHN_DEMO_ROUTER", u"ws://127.0.0.1:8080/ws")
if six.PY2 and type(url) == six.binary_type:
url = url.decode('utf8')
realm = u"crossbardemo"
runner = ApplicationRunner(url, realm)
runner.run(Component)
def slowsquare(x, delay=1):
yield sleep(delay)
returnValue(x * x)
yield self.register(slowsquare, u'com.math.slowsquare')
print("procedures registered")
if __name__ == '__main__':
import six
url = environ.get("AUTOBAHN_DEMO_ROUTER", u"ws://127.0.0.1:8080/ws")
if six.PY2 and type(url) == six.binary_type:
url = url.decode('utf8')
realm = u"crossbardemo"
runner = ApplicationRunner(url, realm)
runner.run(Component)