[英]How to get the original curl request from pycurl?
如果我使用,有什么辦法嗎,
crl = pycurl.Curl()
crl.setopt(pycurl.URL, "www.google.com")
我需要打印原始卷曲請求以進行故障排除
curl www.google.com
pycurl 中沒有組成 curl 命令的功能。
另請注意,您可以使用 pycurl 執行許多無法用 curl 命令表示的操作(例如,寫入 Python IO 對象)。
您可以使用 subprocess 來獲取輸出:
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())
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.