Is there any way if i use,
crl = pycurl.Curl()
crl.setopt(pycurl.URL, "www.google.com")
i need to print the original curl request for troubleshooting
curl www.google.com
There is no feature in pycurl that composes curl commands.
Note also that there are many things you can do with pycurl that cannot be represented with curl command (for example, writing to a Python IO object).
You could use subprocess to get the output:
import subprocess
process = subprocess.Popen(["curl","www.google.com"],shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
stdout, stderr = process.communicate()
print(stdout.decode().strip() , stderr.decode().strip())
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.