Commit 5c5d01a9b21e182ca7e61d157f6c03b91953e503
- Diff rendering mode:
- inline
- side by side
fetch.py
(6 / 3)
  | |||
6 | 6 | import logging | |
7 | 7 | from logging import FileHandler | |
8 | 8 | import pymongo | |
9 | import os | ||
9 | 10 | ||
10 | |||
11 | 11 | app = Flask(__name__) | |
12 | 12 | ||
13 | 13 | @app.route('/', methods=['GET']) | |
… | … | ||
24 | 24 | collection = db['data'] | |
25 | 25 | ret = {} | |
26 | 26 | x = 0 | |
27 | for i in collection.find({'url':request.args['url']}): | ||
27 | resource = "default" | ||
28 | if request.args.has_key('res'): | ||
29 | resource = request.args['res'] | ||
30 | for i in collection.find({'res':resource}): | ||
28 | 31 | del(i['_id']) | |
29 | 32 | ret[x] = i | |
30 | 33 | x = x + 1 | |
31 | jsonify(ret) | ||
34 | return jsonify(ret) | ||
32 | 35 | ||
33 | 36 | ||
34 | 37 | #Log the errors, don't depend on apache to log it for you. |