http.client.HTTPConnection()和cookiejar Python 3

时间:2014-09-26 07:01:31

标签: python http cookies screen-scraping

如何获取php脚本发送给浏览器的cookie?我发现:

Create a cookiejar to store cookie
self.cj = http.cookiejar.CookieJar()
# Create opener
self.opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(self.cj))
urllib.request.install_opener(self.opener)

仅适用于

self.opener.open(url)

???? 我需要存储类似的东西:

conn = http.client.HTTPConnection("myurl")
conn.request("POST", url, "data=test", headers)

0 个答案:

没有答案