From a1a719088d2772b43c6174b1565807c18266b162 Mon Sep 17 00:00:00 2001 From: cami Date: Fri, 23 Jul 2021 00:51:28 +0200 Subject: [PATCH 1/2] Added some more options to requests-script --- requests.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/requests.sh b/requests.sh index ee90262..6cfb89a 100755 --- a/requests.sh +++ b/requests.sh @@ -1,11 +1,11 @@ #!/bin/bash ACTION=$1 -TOKEN=$2 -ACTIONS=(login register rcvpw username) +VALUE=$2 +ACTIONS=(login register rcvpw username data csv) print_help(){ - echo "Usage: $0 ACTION [TOKEN]" + echo "Usage: $0 ACTION [TOKEN|INPUT_TYPE]" echo echo "available actions:" for el in "${ACTIONS[@]}"; do @@ -34,7 +34,15 @@ case $ACTION in ;; "${ACTIONS[3]}") # get current username echo "get username action" - curl localhost:5050/api/username -X GET -H "Authorization: Bearer $TOKEN" + curl localhost:5050/api/username -X GET -H "Authorization: Bearer $VALUE" + ;; + "${ACTIONS[4]}") # get all data from behametricsserver + echo "get data action" + curl localhost:5000/data + ;; + "${ACTIONS[5]}") # get all data from behametricsserver + echo "get data action" + curl localhost:5000/data/csv/"${VALUE}" ;; *) echo "Error: Action not available" From 8e6a74d30c50c6943679ba782bca187e570ecc0a Mon Sep 17 00:00:00 2001 From: cami Date: Fri, 23 Jul 2021 00:52:36 +0200 Subject: [PATCH 2/2] Added a bugfix in the backend --- backend/src/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/app.py b/backend/src/app.py index 7f66284..470e4cf 100644 --- a/backend/src/app.py +++ b/backend/src/app.py @@ -113,7 +113,7 @@ def refresh(): $ curl http://localhost:5000/api/refresh -X GET \ -H "Authorization: Bearer " """ - old_token = request.get_data() + old_token = flask.request.get_data() new_token = guard.refresh_jwt_token(old_token) ret = {'access_token': new_token} return ret, 200