Answers for "python execute curl command and get output"

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
0

executing curl commands in python

import requests
r = requests.get('https://github.com/timeline.json')
r.json()
Posted by: Guest on December-09-2020

Code answers related to "python execute curl command and get output"

Python Answers by Framework

Browse Popular Code Answers by Language