Esempio n. 1
0
def directives(conn: HTTP20Connection):
    stream = conn.request('GET', '/dcs/v1/directives', headers=get_headers())
    while True:
        for push in conn.get_pushes(stream):
            logger.info('Directive: %s', push.push)
        time.sleep(2)
    logger.info('DIRECTIVE QUIT')
Esempio n. 2
0
def ping(conn: HTTP20Connection):
    stream = conn.request('GET', '/dcs/v1/ping', headers=get_headers())
    response = conn.get_response(stream)
    if response.status != 200:
        get_conn(force_create=True)
    logger.info('PING %s', response.status)

    time.sleep(60)
    executor.submit(ping, conn)