[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-survey] 01/02: apikey
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-survey] 01/02: apikey |
Date: |
Mon, 29 Jan 2018 23:36:07 +0100 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository survey.
commit 2a0e362f73d6975f863065dc43792a9a3d949ff2
Author: Florian Dold <address@hidden>
AuthorDate: Mon Jan 29 23:35:07 2018 +0100
apikey
---
talersurvey/survey/survey.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/talersurvey/survey/survey.py b/talersurvey/survey/survey.py
index ca1695c..8a87a8a 100644
--- a/talersurvey/survey/survey.py
+++ b/talersurvey/survey/survey.py
@@ -31,6 +31,8 @@ app.secret_key =
base64.b64encode(os.urandom(64)).decode('utf-8')
TC = TalerConfig.from_env()
BACKEND_URL = TC["frontends"]["backend"].value_string(required=True)
CURRENCY = TC["taler"]["currency"].value_string(required=True)
+# Should eventually be read from the config too!
+APIKEY = TC["frontends"]["backend_apikey"].value_string(required=True)
app.config.from_object(__name__)
LOGGER = logging.getLogger(__name__)
@@ -59,8 +61,9 @@ def err_abort(abort_status_code, **params):
def backend_post(endpoint, json):
+ headers = {"Authorization": "ApiKey " + APIKEY}
try:
- resp = requests.post(urljoin(BACKEND_URL, endpoint), json=json)
+ resp = requests.post(urljoin(BACKEND_URL, endpoint), json=json,
headers=headers)
except requests.ConnectionError:
err_abort(500, message="Could not establish connection to backend")
try:
--
To stop receiving notification emails like this one, please contact
address@hidden