Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #52750
| From | dieter <dieter@handshake.de> |
|---|---|
| Subject | Re: How to keep cookies when making http requests (Python 2.7) |
| Date | 2013-08-21 08:07 +0200 |
| References | <7e79a9b4-0bf9-4756-afd4-3bc127360b95@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.67.1377065271.19984.python-list@python.org> (permalink) |
Luca Cerone <luca.cerone@gmail.com> writes:
> ...
Python has a module for cookie handling: "cookielib" ("cookiejar"
in Python 3).
"urllib2" has a standard way to integrate with this module.
However, I do not know the details (check the documentation
for the modules).
I have used "cookielib" externally to "urllib2". It looks
like this:
from urllib2 import urlopen, Request
from cookielib import CookieJar
cookies = CookieJar()
....
r = Request(...)
cookies.add_cookie_header(r) # set the cookies
R = urlopen(r, ...) # make the request
cookies.extract_cookies(R, r) # remember the new cookies
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to keep cookies when making http requests (Python 2.7) Luca Cerone <luca.cerone@gmail.com> - 2013-08-20 15:24 -0700
Re: How to keep cookies when making http requests (Python 2.7) dieter <dieter@handshake.de> - 2013-08-21 08:07 +0200
Re: How to keep cookies when making http requests (Python 2.7) Luca Cerone <luca.cerone@gmail.com> - 2013-08-21 01:18 -0700
Re: How to keep cookies when making http requests (Python 2.7) Fábio Santos <fabiosantosart@gmail.com> - 2013-08-21 10:15 +0100
Re: How to keep cookies when making http requests (Python 2.7) dieter <dieter@handshake.de> - 2013-08-22 08:08 +0200
Re: How to keep cookies when making http requests (Python 2.7) Luca Cerone <luca.cerone@gmail.com> - 2013-08-27 02:16 -0700
Re: How to keep cookies when making http requests (Python 2.7) Luca Cerone <luca.cerone@gmail.com> - 2013-08-27 03:17 -0700
Re: How to keep cookies when making http requests (Python 2.7) dieter <dieter@handshake.de> - 2013-08-28 06:52 +0200
Re: How to keep cookies when making http requests (Python 2.7) Luca Cerone <luca.cerone@gmail.com> - 2013-08-30 05:01 -0700
csiph-web