1import requests
2
3headers = {
4 'Content-type': 'application/json',
5}
6
7data = '{"text":"Hello, World!"}'
8
9response = requests.post('https://hooks.slack.com/services/asdfasdfasdf', headers=headers, data=data)
1import shlex
2cmd = '''curl -X POST -d '{"nw_src": "10.0.0.1/32", "nw_dst": "10.0.0.2/32", "nw_proto": "ICMP", "actions": "ALLOW", "priority": "10"}' http://localhost:8080/firewall/rules/0000000000000001'''
3args = shlex.split(cmd)
4process = subprocess.Popen(args, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
5stdout, stderr = process.communicate()
1import requests
2res = requests.get('https://stackoverflow.com/questions/26000336')
1url = 'http://example.tld'
2payload = { 'key' : 'val' }
3headers = {}
4res = requests.post(url, data=payload, headers=headers)
1import requests
2r = requests.get('https://github.com/timeline.json')
3r.json()
4