Beispiel #1
0
def init_events_listener(target, event_target, login, password, logs_dir=None):
    """
    Set parameters for the client that will listen to events from the target.
    """
    gazu.set_event_host(event_target)
    gazu.set_host(target)
    gazu.log_in(login, password)
    if logs_dir is not None:
        set_logger(logs_dir)

    return gazu.events.init()
Beispiel #2
0
 def test_set_event_host(self):
     gazu.set_event_host("newhost")
     self.assertEqual(raw.default_client.event_host, "newhost")
     gazu.set_event_host("http://gazu.change.serverhost/api")
Beispiel #3
0
import gazu

gazu.set_host("http://*****:*****@doe.com", "password")


def my_callback(data):
    print("Task status changed:")
    print(data)


try:
    event_client = gazu.events.init()
    gazu.events.add_listener(event_client, "task:status-changed", my_callback)
    gazu.events.run_client(event_client)
except KeyboardInterrupt:
    print("Stop listening.")
except TypeError:
    print("Authentication failed. Please verify your credentials.")