<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="Calibri">Hi Adam,<br>
<br>
I tried to do that, but the .zip file is corrupted. I think that
this is because the URL points to a web page with a link to the
file, not to the file itself. Thus, the save_html just saves the
web page. <br>
In case you want to have a look, the page is here:
<a class="moz-txt-link-freetext" href="http://data.gbif.org/download/downloadReady.htm?downloadFile=occurrence-search-12978055989365071032693658999911.zip">http://data.gbif.org/download/downloadReady.htm?downloadFile=occurrence-search-12978055989365071032693658999911.zip</a><br>
(notice that it will expire in about seven hours from now).<br>
<br>
Thanks a lot,<br>
Avi<br>
<br>
<br>
</font>On 2/16/2011 9:50 AM, Adam Victor Nazareth Brandizzi wrote:
<blockquote
cite="mid:AANLkTikuWPp6QOtTqb5UFR1ypyeTpawU84tMJ7knXUpX@mail.gmail.com"
type="cite">
<pre wrap="">On Wed, Feb 16, 2011 at 1:20 PM, Avi Bar Massada <a class="moz-txt-link-rfc2396E" href="mailto:barmassada@wisc.edu"><barmassada@wisc.edu></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi,
</pre>
</blockquote>
<pre wrap="">
Hi, Avi!
</pre>
<blockquote type="cite">
<pre wrap="">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?
</pre>
</blockquote>
<pre wrap="">
Here I got a ZIP file with "go"
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">go <a class="moz-txt-link-freetext" href="http://jsfcompref.appspot.com/faces/chapter04.zip">http://jsfcompref.appspot.com/faces/chapter04.zip</a>
</pre>
</blockquote>
</blockquote>
<pre wrap="">
and wrote it to a file using "save_html"
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">save_html chapter04.zip
</pre>
</blockquote>
</blockquote>
<pre wrap="">
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?
</pre>
<blockquote type="cite">
<pre wrap="">Thanks!
Avi
</pre>
</blockquote>
<pre wrap="">
Good luck!
</pre>
</blockquote>
</body>
</html>