| Conditions | 1 |
| Total Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | #!/usr/bin/env python |
||
| 6 | def post_json(service, json_data): |
||
| 7 | # POST json to the server API |
||
| 8 | #response = requests.post(service, json={"text":"{}".format(text)}) |
||
| 9 | # for older versions of requests, use the call below |
||
| 10 | #print("SERVICE: {}".format(service)) |
||
| 11 | response = requests.post(service, |
||
| 12 | data=json_data, |
||
| 13 | headers={"content-type": "application/json"}, |
||
| 14 | timeout=None |
||
| 15 | ) |
||
| 16 | # response content should be utf-8 |
||
| 17 | content = response.content.decode("utf-8") |
||
| 18 | #print("CONTENT: {}".format(content)) |
||
| 19 | return json.loads(content) |
||
| 20 |