def main():
    """Main function"""
    parser = argparse.ArgumentParser()
    parser.add_argument('-u', '--username',
                        required=True, help='EBox account')
    parser.add_argument('-p', '--password',
                        required=True, help='Password')
    parser.add_argument('-j', '--json', action='store_true',
                        default=False, help='Json output')
    parser.add_argument('-t', '--timeout',
                        default=REQUESTS_TIMEOUT, help='Request timeout')
    args = parser.parse_args()
    client = EboxClient(args.username, args.password, args.timeout)

    loop = asyncio.get_event_loop()
    task = loop.create_task(client.fetch_data())
    try:
        loop.run_until_complete(task)
    except PyEboxError as exp:
        print(exp)
        client.close_session()
        return
    if not client.get_data():
        client.close_session()
        return
    if args.json:
        print(json.dumps(client.get_data()))
    else:
        _format_output(args.username, client.get_data())
    client.close_session()
Main function