[twill] Downloading a binary file
C. Titus Brown
ctb at msu.edu
Sun Sep 6 17:51:42 PDT 2009
On Fri, Sep 04, 2009 at 10:10:59AM -0400, Jamal Mazrui wrote:
-> Awesome, that worked -- thanks, Titus! By the way, I have researched
-> found nothing currently comparable to twill in terms of the combination
-> of power and friendliness.
I'm actually kind of sorry to hear that. One reason I keep on working
on my own damn software tools is that the other ones are hard to use,
poorly documented or written, or don't meet my (often very simple) use
cases. I'd kind of hoped that something better than twill would exist
elsewhere so that I could either move to it or steal some ideas. Alas.
In any case, you are welcome!
-> -----Original Message-----
-> From: C. Titus Brown [mailto:ctb at msu.edu]
-> Sent: Thursday, September 03, 2009 10:31 PM
-> To: Jamal Mazrui
-> Cc: twill at lists.idyll.org
-> Subject: Re: [twill] Downloading a binary file
-> On Thu, Sep 03, 2009 at 06:04:22PM -0400, Jamal Mazrui wrote:
-> -> I want to develop a web crawler with twill. What might be the best
-> -> way to download non-HTML files while retaining state? For example, a
-> -> script might log into a site and then search for particular .mp3
-> files there.
-> -> I want cookies and the Referer header to be handled correctly when
-> -> making a download request. I have found twill examples that save
-> -> text/HTML but not binary files.
-> Hi Jamal,
-> try this:
-> import twill
-> b = twill.get_browser()
-> b.go('http://some/url/') # <-- REPLACE WITH ACTUAL URL
-> data = b.result.get_page()
-> C. Titus Brown, ctb at msu.edu
C. Titus Brown, ctb at msu.edu
More information about the twill