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). I hope to write some good example code soon. In the mean time, here's a crummy, ugly script: fastmail.py — requires ClientCookie and ClientForm 0.1.x (it also uses ClientTable if you have that installed, but I haven't released the required 0.0.2a version yet).
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).
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 three 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
are being merged into urllib2 for Python 2.4. I hope the cookies,
http-equiv and refresh code will be in there too, along with
mechanize.UserAgent
(but not
mechanize.Browser
). The rest, probably not.
John J. Lee, December 2003.