summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichał 'czesiek' Czyżewski <me@czesiek.net>2013-03-14 17:19:38 +0100
committerMichał 'czesiek' Czyżewski <me@czesiek.net>2013-03-14 17:19:38 +0100
commit7015f78c2d9f3340d823322ae8289b2029507866 (patch)
treebd96b8b72c278b1dfc9bd50cc369bf547c657080
parent65b653b3f51979b63ef10fbb42d564b0c8bb0820 (diff)
downloadhelye-7015f78c2d9f3340d823322ae8289b2029507866.tar.gz
helye-7015f78c2d9f3340d823322ae8289b2029507866.tar.bz2
helye-7015f78c2d9f3340d823322ae8289b2029507866.zip
New requests: /api/words, /api/save (stub)
-rw-r--r--srv.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/srv.py b/srv.py
index 7f97ba2..874dfb0 100644
--- a/srv.py
+++ b/srv.py
@@ -39,6 +39,30 @@ def home(first_id=None, second_id=None, third_id=None):
words = get_words([first_id, second_id, third_id])
return render_template('home.html', words=words)
+@app.route('/api/words')
+def api_words():
+ return json.dumps(['frirst', '2nd', 'th33rd'])
+
+@app.route('/api/save', methods=['POST'])
+def api_save():
+ # TODO: This is a stub
+
+ # also, is this necessary?
+ image_url = None
+ err = None
+
+ try:
+ image_url = request.form['image_url']
+ except KeyError:
+ err = "No image_url provided"
+
+ if err:
+ print err
+ return err
+
+ print image_url
+ return "Saved!"
+
@app.route('/manifest.webapp')
def manifest():
return open('manifest.webapp').read()