summaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
authorleonoverweel <l.overweel@gmail.com>2017-04-01 20:30:43 +0200
committerleonoverweel <l.overweel@gmail.com>2017-04-01 20:30:43 +0200
commit4ab2280c7282944997a7d68414761399e5955e89 (patch)
treef204f51b3adba0b2832f21b697a59c577615d68f /main.py
parent9102f76a9c86f858c4c663750f53241ed242eb9f (diff)
Allow GET, POST, PUT and DELETE for API calls
Diffstat (limited to 'main.py')
-rw-r--r--main.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/main.py b/main.py
index a8048312..50ded468 100644
--- a/main.py
+++ b/main.py
@@ -102,10 +102,11 @@ def sign_in():
return jsonify(**data)
-@FLASK_CORE_APP.route('/api/<string:version>/<path:endpoint_path>')
+@FLASK_CORE_APP.route('/api/<string:version>/<path:endpoint_path>', methods = ['GET', 'POST', 'PUT', 'DELETE'])
def api_call(version, endpoint_path):
"""Call an API endpoint directly over HTTP"""
+ # Get path and parameters
(path, path_parameters) = path_parser.parse(version, endpoint_path)
query_parameters = request.args.to_dict()
@@ -114,7 +115,8 @@ def api_call(version, endpoint_path):
query_parameters[param] = int(query_parameters[param])
except:
pass
-
+
+ # Create and call request
message = {
'id': 0,
'method': request.method,