From 78326a52df7a6db16f5f63599384160c4e3b60cb Mon Sep 17 00:00:00 2001 From: meow Date: Sat, 7 Dec 2019 19:20:34 +0500 Subject: [PATCH] uotp-client added --- uotp/client.py => bin/uotp-client | 14 ++++++++++++-- setup.py | 2 +- uotp/scripts/get-admin.py | 8 -------- 3 files changed, 13 insertions(+), 11 deletions(-) rename uotp/client.py => bin/uotp-client (86%) delete mode 100644 uotp/scripts/get-admin.py diff --git a/uotp/client.py b/bin/uotp-client similarity index 86% rename from uotp/client.py rename to bin/uotp-client index 9fa7eef..686a7db 100644 --- a/uotp/client.py +++ b/bin/uotp-client @@ -1,11 +1,17 @@ +#!/usr/bin/env python3 + import requests import pyotp import argparse -from .config import env_vars +from uotp.config import env_vars, etcd_client +from os.path import join as join_path +from etcd3_wrapper import Etcd3Wrapper arg_parser = argparse.ArgumentParser() -arg_parser.add_argument("action", choices=["list", "create", "verify", "delete"]) +arg_parser.add_argument("action", + choices=["list", "create", "verify", "delete", + "get-admin"]) arg_parser.add_argument("--name") arg_parser.add_argument("--realm") arg_parser.add_argument("--seed") @@ -80,3 +86,7 @@ elif action == "delete": url = "http://localhost:{}/delete/".format(env_vars.get('PORT')) r = requests.post(url, json=data) print(r.content.decode("utf-8")) + +elif action == "get-admin": + admin_uotp = etcd_client.get(join_path(env_vars.get('BASE_PREFIX'), 'admin')) + print(admin_uotp.value) diff --git a/setup.py b/setup.py index a78f1f6..f0c987c 100644 --- a/setup.py +++ b/setup.py @@ -26,5 +26,5 @@ setup(name='uotp', 'pyotp', 'click' ], - scripts=['bin/uotp'], + scripts=['bin/uotp', 'bin/uotp-client'], zip_safe=False) diff --git a/uotp/scripts/get-admin.py b/uotp/scripts/get-admin.py deleted file mode 100644 index c0c1c92..0000000 --- a/uotp/scripts/get-admin.py +++ /dev/null @@ -1,8 +0,0 @@ -import decouple - -from os.path import join as join_path -from etcd3_wrapper import Etcd3Wrapper - -client = Etcd3Wrapper() -admin_uotp = client.get(join_path(decouple.config('BASE_PREFIX'), 'admin')) -print(admin_uotp.value) \ No newline at end of file