【发布时间】:2014-07-17 12:54:35
【问题描述】:
我正在使用 Python 的 Requests 库进行一些网络抓取。我正在使用 Session() 对象在整个 HTTP GET 和 POST 请求链中保留会话。
我需要像这样发出一个 HTTP POST 请求:
POST http://www.examplesite.com/login HTTP/1.1
Host: www.examplesite.com
Proxy-Connection: keep-alive
Content-Length: 126
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Origin: http://www.examplesite.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.137 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Referer: http://www.examplesite.com/anon
Accept-Encoding: sdch
Accept-Language: en-US,en;q=0.8
Cookie: SESS01be97003f5147af7927b0548df40bcd=qud5ra51jmtf9opnihn6tct2v0; has_js=1
我需要将参数has_js=1 添加到Requests 会话中的cookie 对象中。我无法找到有关此特定要求的任何信息。非常感谢您的帮助!
【问题讨论】:
标签: python http cookies request