From aeae5a2aad1f9c5ab1ed62fffdc77f647bc5afee Mon Sep 17 00:00:00 2001 From: Yuval Adam Date: Wed, 14 Mar 2012 00:20:03 -0700 Subject: still not really working --- app.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'app.py') 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) -- cgit v1.3.1