现在 python 哪个请求库支持类似这样的 header ?
大部分的 header 都是通过 dict 封装的,
多个重复的 header 没法子传啊。
POST /api/xxx/xxxx HTTP/1.1
Cust-Header: cookie_line_1
Cust-Header: cookie_line_2
Cust-Header: cookie_line_3
Cust-Header: cookie_line_4
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
User-Agent: Dalvik/2.1.0 (Linux; U; Android 6.0.1; SM-G9200 Build/MMB29K)
Host: xxx.xxx.com
Connection: Keep-Alive
Accept-Encoding: gzip
Content-Length: 926
1
mymusise 2017-01-05 22:57:55 +08:00
推荐 requests
import request headers = { "Cust-Header": "cookie_line_1", "Cust-Header": "cookie_line_2", "Cust-Header": "cookie_line_3", "Cust-Header": "cookie_line_4", "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", "User-Agent": "Dalvik/2.1.0 (Linux; U; Android 6.0.1; SM-G9200 Build/MMB29K)", "Host": "xxx.xxx.com", "Connection": "Keep-Alive", "Accept-Encoding": "gzip", "Content-Length": "926" } url = "" requests.post(url, headers=headers) |
3
Contextualist 2017-01-06 17:55:12 +08:00 via iPad 1
|
4
mymusise 2017-01-06 22:07:55 +08:00
@janstk 哦,你是这个意思,不过
Cust-Header: cookie_line_1 Cust-Header: cookie_line_2 Cust-Header: cookie_line_3 Cust-Header: cookie_line_4 不等效于 Cust-Header: cookie_line_1 , cookie_line_2,cookie_line_3,cookie_line_4 么? |
6
janstk OP @Contextualist 感谢,没想到 header 的 value 还能带换行。哈哈哈哈。受教了
|