Commit 85fe77fe8052ff5c0f23f3449cd3f9fcecbd3f4f

  • avatar
  • arvind
  • Fri Jun 21 20:04:23 IST 2013
Spec for sweet-maker is followed now in the coding style.
  • Diff rendering mode:
  • inline
  • side by side

sweetmaker.py

1import requests1import requests
2import json2import json
3def make(what, who, where, how):
3
4def sweet(sweet_url, what, who, where, how):
4 sweet = {}5 sweet = {}
5 sweet['what'] = what6 sweet['what'] = what
6 sweet['who'] = who7 sweet['who'] = who
7 sweet['where'] = where8 sweet['where'] = where
8 sweet['how'] = how9 sweet['how'] = how
9 sweet_list = []10 sweet_list = []
10 sweet_list.append(sweet)
11 return sweet_list
12
13
14def send(sweet):
15 request = requests.api.post(SWEET_STORE_URL,{'data':json.dumps(sweet)})
11 request = requests.api.post(sweet_url, {'data':json.dumps(sweet)})
16 if request.status_code == 200:12 if request.status_code == 200:
17 return True13 return True
18 else:14 else: