diff options
author | Michał 'czesiek' Czyżewski <me@czesiek.net> | 2013-03-14 17:19:38 +0100 |
---|---|---|
committer | Michał 'czesiek' Czyżewski <me@czesiek.net> | 2013-03-14 17:19:38 +0100 |
commit | 7015f78c2d9f3340d823322ae8289b2029507866 (patch) | |
tree | bd96b8b72c278b1dfc9bd50cc369bf547c657080 | |
parent | 65b653b3f51979b63ef10fbb42d564b0c8bb0820 (diff) | |
download | helye-7015f78c2d9f3340d823322ae8289b2029507866.tar.gz helye-7015f78c2d9f3340d823322ae8289b2029507866.tar.bz2 helye-7015f78c2d9f3340d823322ae8289b2029507866.zip |
New requests: /api/words, /api/save (stub)
-rw-r--r-- | srv.py | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -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() |