Exemplo n.º 1
0
    def send_single(receiver, body):
        self = agent_repo.get_byname('~self')

        url = 'http://{0}:8888/incoming'.format(receiver.hostname)
        session = FuturesSession()
        response_future = session.post(url, data={'sender': self.hostname, 'content': body})

        # wait for the response to come in
        response_future.result()
Exemplo n.º 2
0
def initialize_db():
    database.connect()
    for model in model_list:
        database.create_table(model, safe=True)

    _self = agent_repo.get_byname("~self", create_if_nonexist=True)
    _self.hostname = 'localhost'
    _self.save()

    database.close()
    return database