Created
August 6, 2010 21:12
-
-
Save harthur/512010 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import httplib | |
import json | |
result = { | |
"firefox": { | |
"build_id": "20100401064631", | |
"version": "3.6.3" | |
}, | |
"run_id": 0, | |
"timestamp": 1279376772, | |
"results": [ | |
1914, | |
1169, | |
1154, | |
1159, | |
1180 | |
], | |
"addon": { | |
"downloads": 12398, | |
"id": 5677, | |
"name": "Reframe It" | |
}, | |
"os": { | |
"version": "OS X 10.6.2", | |
"bits": "64", | |
"name": "Mac", | |
"cpu": "x86_64" | |
}, | |
"test_type": "ts" | |
} | |
connection = httplib.HTTPConnection('localhost:5984') | |
connection.request("POST", '/testdb', json.dumps(result)) | |
# Get response which contains the id of the new document | |
response = connection.getresponse() | |
data = json.loads(response.read()) | |
connection.close() | |
if not data['ok']: | |
print "creating report document failed" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment