ANN: mechanize 0.0.7a released (original) (raw)
John J. Lee jjl@pobox.com
09 Jan 2004 20:04:11 +0000
- Previous message: ANN: ClientForm 0.1.15 released (and 0.0.15, some time ago)
- Next message: Zope 2.7.0 beta 4 Release and Security Update
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
http://wwwsearch.sourceforge.net/mechanize/
This is an alpha release.
Changes since 0.0.2a:
- Fixed lots of bugs.
- Link instances may now be passed to .click_link() and .follow_link().
- Added a new example program, pypi.py.
- ClientCookie 0.4.17 and pullparser 0.0.4b are now required (in fact, they always were, even though they didn't exist ;-).
Requires Python 2.2, ClientCookie >= 0.4.17 (note version!), ClientForm 0.1.x and pullparser >= 0.0.4b.
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/")
follow second link with element text matching regular expression
response = b.follow_link(text_regex=re.compile(r"cheese\s*shop"), nr=1)
b.select_form(name="order")
Browser passes through unknown attributes (including methods)
to the selected HTMLForm (from ClientForm).
b["cheeses"] = ["mozzarella", "caerphilly"] # (the method here is setitem) response2 = b.submit() # submit current form
response3 = b.back() # back to cheese shop response4 = b.reload()
for link in b.forms(): print form
.links() optionally accepts the keyword args of .follow_/.find_link()
for link in b.links(url_regex=re.compile("python.org")): print link b.follow_link(link) # takes EITHER Link instance OR keyword args b.back()
John
- Previous message: ANN: ClientForm 0.1.15 released (and 0.0.15, some time ago)
- Next message: Zope 2.7.0 beta 4 Release and Security Update
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]