[twill] Downloading a .zip file

Adam Victor Nazareth Brandizzi brandizzi at gmail.com
Wed Feb 16 07:50:08 PST 2011


On Wed, Feb 16, 2011 at 1:20 PM, Avi Bar Massada <barmassada at wisc.edu> wrote:
> Hi,

Hi, Avi!

> I've been using twill with a python script to automate downloads from
> web-based databases. Until now, I only needed to fetch text files, so it was
> pretty simple. I've been using:
>
> go("web address")
> b = twill.get_browser()
> data = b.result.get_page()
>
> Now, I'm trying to fetch data from a different website, which generates a
> link to a .zip file. Given that I know the direct URL to the zip file, would
> it be possible to download it directly using twill? Clicking on the link in
> the actual page opens a download dialogue box. Is there any way to bypass it
> and just get the file directly?


Here I got a ZIP file with "go"

>> go http://jsfcompref.appspot.com/faces/chapter04.zip

and wrote it to a file using "save_html"

>> save_html chapter04.zip

It worked flawlessly:

Diderot:sandbox brandizzi$ unzip chapter04.zip
Archive:  chapter04.zip
   creating: chapter04/web/
  [...]
  inflating: build.properties.sample

Have you tried to do it?

> Thanks!
> Avi
>

Good luck!

-- 
Adam Victor Nazareth Brandizzi
http://brandizzi.googlepages.com/



More information about the twill mailing list