def main():
    args = parse_arguments()
    if args.debug:
        logging.basicConfig(level=logging.DEBUG)
    client = Lift(ip_address=args.server)
    count = 0
    if args.create:
        try:
            client.create_stream(Stream(args.subject, args.stream))
        except ErrStreamExists:
            pass
    try:
        for message in client.subscribe(Stream(args.subject, args.stream).start_at_earliest_received()):
            print("{} [#{}] Received on [{} - {}]: '{}'".format(datetime.fromtimestamp((int(message.timestamp) / 1000000000)), count, args.subject, args.stream, message.value.decode('utf-8')))
            count = (count + 1)
    except ErrNoSuchStream:
        print("The stream {} doesn't exist. With -c or --create it's creation can be forced.".format(args.stream))
def main():
    args = parse_arguments()
    if args.debug:
        logging.basicConfig(level=logging.DEBUG)
    client = Lift(ip_address=args.server)
    count = 0
    if args.create:
        try:
            client.create_stream(Stream(args.subject, args.stream))
        except ErrStreamExists:
            pass
    try:
        for message in client.subscribe(Stream(args.subject, args.stream).start_at_earliest_received()):
            print("{} [#{}] Received on [{} - {}]: '{}'".format(datetime.fromtimestamp((int(message.timestamp) / 1000000000)), count, args.subject, args.stream, message.value.decode('utf-8')))
            count = (count + 1)
    except ErrNoSuchStream:
        print("The stream {} doesn't exist. With -c or --create it's creation can be forced.".format(args.stream))