There's (still!) a bit of a shortage of example code for ClientCookie and ClientForm &co., because the stuff I've written tends to either require access to restricted-access sites, or is proprietary code (and the same goes for other people's code).
Use this _socket.pyd, or use Python 2.3.
Three good options:
-trace
,
and filter out the junk with a script.
I'm told you can also use a proxy like proxomitron (never tried it myself). There's also a commercial MSIE plugin.
It is possible to embed script in HTML pages (sandwiched between
<SCRIPT>here</SCRIPT>
tags, and in
javascript:
URLs) - JavaScript / ECMAScript, VBScript, or
even Python. These scripts can do all sorts of things, including causing
cookies to be set in a browser, submitting or filling in parts of forms in
response to user actions, changing link colours as the mouse moves over a
link, etc.
If you come across this in a page you want to automate, you have four options. Here they are, roughly in order of simplicity.
CookieJar
instance, calling methods on
HTMLForm
s, calling urlopen
, etc.
The request / response processing extensions to urllib2 from ClientCookie
have been merged into urllib2 for Python 2.4. The cookie processing has
been added, as module cookielib. Eventually, I'll submit patches to get
the http-equiv, refresh, and robots.txt code in there too, and maybe
mechanize.UserAgent
too (but not
mechanize.Browser
). The rest, probably not.
John J. Lee, January 2005.