Commit 103754345878c35b64e889dc0c0c107d6ee62fe3

  • avatar
  • arvind
  • Tue Jul 16 15:44:58 IST 2013
pymongo updated methods to write and initiate a db
  • Diff rendering mode:
  • inline
  • side by side

server.py

3131
32@app.route('/fetch', methods=['GET'])32@app.route('/fetch', methods=['GET'])
33def fetch():33def fetch():
34 connection = pymongo.Connection()
34 connection = pymongo.MongoClient('localhost',27017)
35 db = connection['mural']35 db = connection['mural']
36 collection = db['data']36 collection = db['data']
37 ret = {}37 ret = {}
5858
59@app.route('/search', methods=['GET'])59@app.route('/search', methods=['GET'])
60def search():60def search():
61 connection = pymongo.Connection()
61 connection = pymongo.MongoClient('localhost',27017)
62 db = connection['mural']62 db = connection['mural']
63 collection = db['data']63 collection = db['data']
64 y = 064 y = 0
9797
98@app.route('/submit', methods=['POST'])98@app.route('/submit', methods=['POST'])
99def submit():99def submit():
100 c = pymongo.Connection()
100 c = pymongo.MongoClient('localhost',27017)
101 db = c['mural']101 db = c['mural']
102 coll = db['data']102 coll = db['data']
103 requestData = json.loads(request.form['data'])103 requestData = json.loads(request.form['data'])