diff options
| author | Yuval Adam <yuv.adm@gmail.com> | 2012-03-14 00:20:03 -0700 |
|---|---|---|
| committer | Yuval Adam <yuv.adm@gmail.com> | 2012-03-14 00:20:03 -0700 |
| commit | aeae5a2aad1f9c5ab1ed62fffdc77f647bc5afee (patch) | |
| tree | 2bb2df18f4e5d76bc24c79cbbc306c86747abf94 | |
| parent | 3fafc721641225fbdbfd28d698f0286e4e9e6451 (diff) | |
still not really working
| -rw-r--r-- | app.py | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -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) |
