Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #52750
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.06; 'urllib2': 0.07; 'cookie': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:2.7': 0.09; 'subject:How': 0.10; 'python': 0.11; 'cookies': 0.16; 'handling:': 0.16; 'modules).': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'subject:making': 0.16; 'subject:requests': 0.16; 'subject:when': 0.16; 'module': 0.19; 'import': 0.22; 'header:User-Agent:1': 0.23; 'integrate': 0.24; 'looks': 0.24; 'this:': 0.26; 'header:X-Complaints-To:1': 0.27; 'writes:': 0.31; 'subject: (': 0.35; 'module.': 0.36; 'charset:us- ascii': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'new': 0.61; 'received:217': 0.63; 'details': 0.65; '.....': 0.78 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | dieter <dieter@handshake.de> |
| Subject | Re: How to keep cookies when making http requests (Python 2.7) |
| Date | Wed, 21 Aug 2013 08:07:35 +0200 |
| References | <7e79a9b4-0bf9-4756-afd4-3bc127360b95@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| X-Gmane-NNTP-Posting-Host | pd9e0948d.dip0.t-ipconnect.de |
| User-Agent | Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (linux) |
| Cancel-Lock | sha1:ee7qP8hRCrMqW5DViYPq+qP5YHA= |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.67.1377065271.19984.python-list@python.org> (permalink) |
| Lines | 24 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1377065271 news.xs4all.nl 15949 [2001:888:2000:d::a6]:33768 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:52750 |
Show key headers only | View raw
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