Friday, July 6, 2007

Twill Tips - Links

Assumed that you have some links on html page, you may want to find and go to the url ended with "/items" by using twill in the python command line environment:

a=showlinks()
for i in a:
if i.url.find("/items") > 0 :
URL_items=i.absolute_url

print "=====", URL_items
b.go(URL_items)

a contains Link Object, which has url and absolute_url attribute. we use url attribute to search for "/items", then access the page by using absolute_url attribute

No comments: