[英]Sending data (not form) in wreq
鑒於形式的curl
請求:
curl --header "Content-Type: text/xml;charset=UTF-8" --data @somefile.xml http://httpbin.org/post
我們怎么能在wreq
做到這wreq
? 我通過httpbin的回聲確認數據是作為“數據”發送的 - 下面是來自httpbin
post echo的片段:
{
"args": {},
"data": "<file-contents here sent by curl --data option>",
"files": {},
"form": {},
"headers": {...
...},
"json": null,
"origin": "some_ip",
"url": "http://httpbin.org/post"
}
所以,基本上,如果將文件中的數據作為Text
或String
,我們如何在不使用form
multi-part
情況下將其Postable
為wreq
(除非curl的data
選項只是偽裝的form
multi-part
帖子)? 我正在挖掘wreq
文檔但尚未發現任何相關內容。 我非常感謝有關如何做到這一點的指示。 如教程中所示,在wreq
設置headers
和其他內容非常簡單。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.