summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuval Adam <yuv.adm@gmail.com>2012-03-14 00:20:03 -0700
committerYuval Adam <yuv.adm@gmail.com>2012-03-14 00:20:03 -0700
commitaeae5a2aad1f9c5ab1ed62fffdc77f647bc5afee (patch)
tree2bb2df18f4e5d76bc24c79cbbc306c86747abf94
parent3fafc721641225fbdbfd28d698f0286e4e9e6451 (diff)
still not really working
-rw-r--r--app.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/app.py b/app.py
index 390831f..fa20998 100644
--- a/app.py
+++ b/app.py
@@ -1,3 +1,4 @@
+import json
import os
import random
import requests
@@ -15,10 +16,10 @@ def sig(id='home'):
@post('/s')
def sig(id='home'):
- data = request.POST.output
- id = ''.join(random.choice(string.ascii_lowercase + string.digits) for x in range(6))
- url = 'https://pinkyswear.cloudant.com/pinkyswear/%s' % id
- requests.post(url, auth=('pinkyswear', 'abc123'), data=data)
- return id
+ data = json.dumps(request.POST['output'])
+ url = 'https://pinkyswear.cloudant.com/pinkyswear/'
+ headers = { 'content-type' : 'application/json' }
+ r = requests.post(url, auth=('pinkyswear', 'abc123'), data=data, headers=headers)
+ return r.content
run(host='localhost', port=8000)