Ejemplo n.º 1
0
def main(host, outfile, level='INFO', interval='5'):
	interval = float(interval)
	logging.basicConfig(level=level)
	client = Client(host, on_update=on_update)
	while not client.finished.ready():
		gevent.sleep(interval)
		if client.pipdata.root:
			if os.path.exists(outfile):
				os.rename(outfile, '{}.tmp'.format(outfile))
			with open(outfile, 'w') as f:
				f.write(json.dumps(client.pipdata.root.value, indent=4) + '\n')
	client.wait()
Ejemplo n.º 2
0
def main(host, level='INFO', interval='5'):
	global client
	interval = float(interval)
	logging.basicConfig(level=level, filename='/tmp/log')
	client = Client(host, on_update=on_update)
	client.wait()