Adding a cookie

koranthala koranthala at gmail.com
Sun Jan 17 06:22:46 EST 2010


Hi,
    I am creating a webscraper for a specific web site for an
application.
    Now, that website has a specific cookie which needs to be set in
the request. Otherwise, the website is redirected.
    I have been trying for the last 6 hours to add a cookie to the
HTTP request, but to no avail.
    I tried mechanize for some time, then found the cookielib module
which again is a copy of it.
    For such a small thing, the whole setup seems to be too
complicated.

   The only way I could get any cookie in using the extract_cookies
from a cookiejar. But that will not help me because I want to add one
cookie - not get cookie from req and send it back.

    Can anyone help me out?



More information about the Python-list mailing list