Use existing IE cookie

KB keith at nekotaku.com
Thu Jul 30 12:31:33 EDT 2009


On Jul 30, 9:23 am, "Diez B. Roggisch" <de... at nospam.web.de> wrote:
> KB wrote:
>
> >> What does you full example look like, including the
> >> cookie-acquisition-stuff?
>
> >> Diez
>
> > I ran them seperately, hoping for a clue as to what my "cookiejar"
> > was.
>
> > The cookie-acquisition stuff returns "screener.ashx?v=151" when I
> > search with my domain I am interested in. I have tried
> > urllib2.HTTPCookieProcessor('screener.ashx?v=151') but that failed
> > with attr has no cookie header.
>
> > From the HTTPCookieProcessor doco, it appears that non-IE browsers
> > have a cookie file (and example code) but from what I can tell IE uses
> > a hidden folder. (you can set your location in IE but it appends a
> > folder "\Temporary Internet Files"  -
>
> > From:http://docs.python.org/dev/library/cookielib.html
>
> > ***
> > This example illustrates how to open a URL using your Netscape,
> > Mozilla, or Lynx cookies (assumes Unix/Netscape convention for
> > location of the cookies file):
>
> > import os, cookielib, urllib2
> > cj = cookielib.MozillaCookieJar()
> > cj.load(os.path.join(os.environ["HOME"], ".netscape/cookies.txt"))
> > opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
> > r = opener.open("http://example.com/")
> > ***
>
> > Not sure how to adapt this for IE.
>
> You could create a file that resembles the cookies.txt - no idea how that
> looks, but I guess it's pretty simple.
>
> Diez- Hide quoted text -
>
> - Show quoted text -

Yeah unfortunately I just tried Firefox and it uses cookies.sqlite
now... more dead ends :)



More information about the Python-list mailing list