Look in the examples directory of mechanize. Note that the examples on the ClientForm page are executable as-is. Contributions of example code would be very welcome!
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
HTMLForms, calling urlopen, etc.
ctypes' COM support is
still evolving).
This
kind of thing may also come in useful on Windows for cases where the
automation API is lacking.
pyphany
is a binding to the
epiphany web browser, allowing both plugins and automation code to be
written in Python.
XXX Mozilla automation & XPCOM / PyXPCOM, Konqueror & DCOP / KParts / PyKDE).
urllib2 (originally part of the yum package manager, but
now becoming a separate project).
The request / response processing extensions to urllib2 from
mechanize 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.
I prefer questions and comments to be sent to the mailing list rather than direct to me.
John J. Lee, May 2006.