[twill] Newbie question on approach to following links relative to text

Hal Wine hal.wine at gmail.com
Tue Jul 25 12:06:26 PDT 2006


I'm trying to learn twill with a "simple" example of scraping a web
page and sending an email based on content.

I'm not fully groking what to do in python, and what to have twill do.
Suggestions welcome, or pointers to any similar example welcome.

Basically, I want to scrape a tinderbox status page, which is a big
table. Cell data consists of 3 links followed by text. If the text
contains 'errs:', then I want to follow one of the preceding links. In
pseudo code:
  find cell with 'junit' in it
  if cell also has 'errs:' in it, then follow the 2nd link prior to
this position.

I can use 'find' to get the cell data. What I'm confused about is if
there is any support in twill for it to parse the preceding links, or
if I do that in python then pass the extracted URL to 'follow'? Or
should I just write an extension to add that? Or is there a way to
know that my 'find' is between links X & Y, so I can just access
showlinks()[X-1].

Thanks



More information about the twill mailing list