GET method replaced by POST method

This commit is contained in:
ahmadbilalkhalid 2019-11-21 16:42:18 +05:00
parent e4034813a2
commit c8b67c5c50
2 changed files with 5 additions and 5 deletions

6
app.py
View file

@ -18,7 +18,7 @@ create_admin_if_dont_exists(etcd_client)
class Verify(Resource): class Verify(Resource):
@staticmethod @staticmethod
def get(): def post():
data = request.json data = request.json
if data: if data:
schema = OTPSchema(data) schema = OTPSchema(data)
@ -74,7 +74,7 @@ class Delete(Resource):
class List(Resource): class List(Resource):
@staticmethod @staticmethod
def get(): def post():
data = request.json data = request.json
schema = ListAccountSchema(data) schema = ListAccountSchema(data)
@ -100,4 +100,4 @@ api.add_resource(Delete, "/delete")
api.add_resource(List, "/list") api.add_resource(List, "/list")
if __name__ == "__main__": if __name__ == "__main__":
app.run(debug=True, port=decouple.config("PORT", int)) app.run(debug=True, host="::", port=decouple.config("PORT", int))

View file

@ -29,7 +29,7 @@ if action == "list":
"admin_realm": args.admin_realm, "admin_realm": args.admin_realm,
"admin_token": pyotp.TOTP(args.admin_seed).now() "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) json=data)
print(r.content.decode("utf-8")) print(r.content.decode("utf-8"))
@ -61,7 +61,7 @@ elif action == "verify":
"auth_realm": args.auth_realm, "auth_realm": args.auth_realm,
"auth_token": pyotp.TOTP(args.auth_seed).now() "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) json=data)
print(r.content.decode("utf-8")) print(r.content.decode("utf-8"))