Answers for "make curl commands in python"

1

python run curl

import shlex
cmd = '''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'''
args = shlex.split(cmd)
process = subprocess.Popen(args, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = process.communicate()
Posted by: Guest on June-26-2020
1

python run curl

import requests
res = requests.get('https://stackoverflow.com/questions/26000336')
Posted by: Guest on June-26-2020

Code answers related to "make curl commands in python"

Python Answers by Framework

Browse Popular Code Answers by Language