[Tutor] file fetcher class object through http

James Thornton james at jamesthornton.com
Sat Aug 20 06:07:15 CEST 2011


> Essentially, I want to write a class that finds, and downloads a file from a
> web server. mostly, I am looking for a smart class implementation that has
> well-considered API and method choices.

httplib2 (http://code.google.com/p/httplib2) by Joe Gregorio of Google
is what I use. It has an intuitive interface that's easy to use.

$ pip install httplib2

>>> import httplib2
>>> http = httplib2.Http()
>>> resp, content = http.request("http://example.org/", "GET")

Here are more examples: http://code.google.com/p/httplib2/wiki/Examples

- James

-- 
Bulbflow: A Python framework for graph databases (http://bulbflow.com)


More information about the Tutor mailing list