ANN: mechanize 0.0.2a released
John J. Lee
jjl@pobox.com
29 Dec 2003 00:47:21 +0000
http://wwwsearch.sourceforge.net/mechanize/
This is an alpha release.
Changes since 0.0.1a:
* Updated broken example code.
* Fixed and added a test for UserAgent, which was pretty broken.
* Fixed a bug in link parsing.
* Added and improved docstrings.
* Attribute lookups are no longer forwarded to .response -- you have
to do it explicitly.
* Added .geturl() method, which just delegates to .response.
* Browser.form is now a public attribute. Also documented Browser's
public attributes.
* Added base_url and absolute_url attributes to Link.
* Tidied up .open(). Relative URL Request objects are no longer
converted to absolute URLs -- they should probably be absolute in
the first place anyway.
* Added proper Referer handling (the handler in ClientCookie is a
hack that only covers a restricted case).
* Added click_link method, for symmetry with .click() / .submit()
methods (which latter apply to forms). Of these methods,
.click/.click_link() returns a request, and .submit/ .follow_link()
actually .open()s the request.
Requires Python 2.2, ClientCookie >= 0.4.12 (note version!), ClientForm
0.1.x and pullparser >= 0.2.b.
Stateful programmatic web browsing, after Andy Lester's Perl module
WWW::Mechanize.
Example:
import re
from mechanize import Browser
b = Browser()
b.open("http://www.example.com/")
response = b.follow_link(text_regex=re.compile(r"cheese\s*shop"), nr=1)
b.select_form(name="order")
b["cheeses"] = ["mozzarella", "caerphilly"]
response2 = b.submit()
response3 = b.back() # back to cheese shop
response4 = b.reload()
for link in b.forms():
print form
for link in b.links(url_regex=re.compile("python.org")):
print link
John