Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/320.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将curl命令复制到python_Python_Curl - Fatal编程技术网

将curl命令复制到python

将curl命令复制到python,python,curl,Python,Curl,我将图片上传到imgbb.com网站,并使用firefox显示curl命令 curl "https://imgbb.com/json" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0" -H "Accept: application/json" -H "Accept-Language: e

我将图片上传到imgbb.com网站,并使用firefox显示curl命令

curl "https://imgbb.com/json" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0" -H "Accept: application/json" -H "Accept-Language: en-US,en;q=0.5" --compressed -H "Content-Type: multipart/form-data; boundary=---------------------------270624834321652808912303071412" -H "Origin: https://imgbb.com" -H "Connection: keep-alive" -H "Referer: https://imgbb.com/" -H "Cookie: PHPSESSID=6o18hipgu8uk8orq4pg47of4b5; __gads=ID=40783678319bf866-227f347cf1a6003f:T=1614875864:RT=1614875864:S=ALNI_MbBjogRusDweg41MHFP01KawfJuiw" -H "DNT: 1" -H "Sec-GPC: 1" -H "TE: Trailers" --data-binary "-----------------------------270624834321652808912303071412"^

"Content-Disposition: form-data; name=""source""; filename=""test.png"""^

"Content-Type: image/png"^

""^

"-----------------------------270624834321652808912303071412"^

"Content-Disposition: form-data; name=""type"""^

""^

"file"^

"-----------------------------270624834321652808912303071412"^

"Content-Disposition: form-data; name=""action"""^

""^

"upload"^

"-----------------------------270624834321652808912303071412"^

"Content-Disposition: form-data; name=""timestamp"""^

""^

"1614875900988"^

"-----------------------------270624834321652808912303071412"^

"Content-Disposition: form-data; name=""auth_token"""^

""^

"e47e40461c19ef13a3768c45e2a0a5189f3bf625"^

"-----------------------------270624834321652808912303071412--"^

""
我可以看到我上传的
test.png
图片

如何使用具有不同图片的python再次发送该命令?

您可以使用


但是你真的应该改用。

有没有离线工具可以将curl转换为python请求?我不知道。我认为最好只使用API。