Commit 5c5d01a9b21e182ca7e61d157f6c03b91953e503

  • avatar
  • arvind
  • Wed Mar 27 17:11:06 IST 2013
Fixing fetch.py
			 - Added missing import and a return statement
  • Diff rendering mode:
  • inline
  • side by side

fetch.py

6import logging6import logging
7from logging import FileHandler7from logging import FileHandler
8import pymongo8import pymongo
9import os
910
10
11app = Flask(__name__)11app = Flask(__name__)
1212
13@app.route('/', methods=['GET'])13@app.route('/', methods=['GET'])
24 collection = db['data']24 collection = db['data']
25 ret = {}25 ret = {}
26 x = 026 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 del(i['_id'])31 del(i['_id'])
29 ret[x] = i32 ret[x] = i
30 x = x + 133 x = x + 1
31 jsonify(ret)
34 return jsonify(ret)
3235
3336
34#Log the errors, don't depend on apache to log it for you.37#Log the errors, don't depend on apache to log it for you.