5c78a27 by Arvind at 2012-06-17 | 1 | import json |
2 | import pymongo |
|
3 | def application(environ, start_response): |
|
4 | status = '200 OK' |
|
5 | response_headers = [('Content-type', 'text/html'),('Access-Control-Allow-Origin', '*')] |
|
6 | start_response(status, response_headers) |
|
7 | recieved = environ['wsgi.input'].read(int(environ['CONTENT_LENGTH'])) |
|
8 | c = pymongo.Connection() |
|
9 | db = c['mural'] |
|
10 | coll = db['data'] |
|
11 | d = json.loads(recieved) |
|
12 | for i in d: |
|
13 | coll.insert(d) |
|
14 | return 'ok' |
|
15 |