Commit 85fe77fe8052ff5c0f23f3449cd3f9fcecbd3f4f
Spec for sweet-maker is followed now in the coding style.
| | | | 1 | import requests | 1 | import requests |
---|
2 | import json | 2 | import json |
---|
3 | def make(what, who, where, how): | | def make(what, who, where, how): |
---|
| | 3 | | | | 4 | def sweet(sweet_url, what, who, where, how): |
---|
4 | sweet = {} | 5 | sweet = {} |
---|
5 | sweet['what'] = what | 6 | sweet['what'] = what |
---|
6 | sweet['who'] = who | 7 | sweet['who'] = who |
---|
7 | sweet['where'] = where | 8 | sweet['where'] = where |
---|
8 | sweet['how'] = how | 9 | sweet['how'] = how |
---|
9 | sweet_list = [] | 10 | sweet_list = [] |
---|
10 | sweet_list.append(sweet) | | sweet_list.append(sweet) |
---|
11 | return sweet_list | | return sweet_list |
---|
12 | | | |
---|
13 | | | |
---|
14 | def send(sweet): | | def send(sweet): |
---|
15 | request = requests.api.post(SWEET_STORE_URL,{'data':json.dumps(sweet)}) | | 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 True | 13 | return True |
---|
18 | else: | 14 | else: |
---|