示例#1
0
def new_connection_to_xbus():
    front_url = settings.XBUS_EMITTER_URL
    login = settings.XBUS_EMITTER_LOGIN
    password = settings.XBUS_EMITTER_PASSWORD

    conn = ZmqRpcClient(front_url, timeout=1000)
    token = conn.login(login, password)

    if not token:
        raise Exception('Error: Authentication failed.')

    return conn, token
示例#2
0
def new_connection_to_xbus():
    front_url = settings.XBUS_EMITTER_URL
    login = settings.XBUS_EMITTER_LOGIN
    password = settings.XBUS_EMITTER_PASSWORD

    conn = ZmqRpcClient(front_url, timeout=1000)
    token = conn.login(login, password)

    if not token:
        raise Exception('Error: Authentication failed.')

    return conn, token
    def register_to_xbus(self):
        # Wait 1s to give the server time to start
        # (because XBus will contact the server)
        sleep(1)

        # Connect to XBus
        client = ZmqRpcClient(CONSUMER_URL, timeout=1000)
        token = client.login(CONSUMER_LOGIN, CONSUMER_PASSWORD)
        if not token:
            logger.error(u'Authentication failed')
            return

        client.register_node(token, CONSUMER_LISTEN)
        logger.info(u'Registration done')
    def register_to_xbus(self):
        # Wait 1s to give the server time to start
        # (because XBus will contact the server)
        sleep(1)

        # Connect to XBus
        client = ZmqRpcClient(CONSUMER_URL, timeout=1000)
        token = client.login(CONSUMER_LOGIN, CONSUMER_PASSWORD)
        if not token:
            logger.error(u'Authentication failed')
            return

        client.register_node(token, CONSUMER_LISTEN)
        logger.info(u'Registration done')