From c8b67c5c5062aa414c50d6c929189c450e39e424 Mon Sep 17 00:00:00 2001 From: meow Date: Thu, 21 Nov 2019 16:42:18 +0500 Subject: [PATCH] GET method replaced by POST method --- app.py | 6 +++--- client.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app.py b/app.py index a4d07fb..66fe667 100644 --- a/app.py +++ b/app.py @@ -18,7 +18,7 @@ create_admin_if_dont_exists(etcd_client) class Verify(Resource): @staticmethod - def get(): + def post(): data = request.json if data: schema = OTPSchema(data) @@ -74,7 +74,7 @@ class Delete(Resource): class List(Resource): @staticmethod - def get(): + def post(): data = request.json schema = ListAccountSchema(data) @@ -100,4 +100,4 @@ api.add_resource(Delete, "/delete") api.add_resource(List, "/list") if __name__ == "__main__": - app.run(debug=True, port=decouple.config("PORT", int)) + app.run(debug=True, host="::", port=decouple.config("PORT", int)) diff --git a/client.py b/client.py index 7c50913..ca0116b 100644 --- a/client.py +++ b/client.py @@ -29,7 +29,7 @@ if action == "list": "admin_realm": args.admin_realm, "admin_token": pyotp.TOTP(args.admin_seed).now() } - r = requests.get("http://localhost:{}/list".format(decouple.config('PORT')), + r = requests.post("http://localhost:{}/list".format(decouple.config('PORT')), json=data) print(r.content.decode("utf-8")) @@ -61,7 +61,7 @@ elif action == "verify": "auth_realm": args.auth_realm, "auth_token": pyotp.TOTP(args.auth_seed).now() } - r = requests.get("http://localhost:{}/verify".format(decouple.config('PORT')), + r = requests.post("http://localhost:{}/verify".format(decouple.config('PORT')), json=data) print(r.content.decode("utf-8"))