[Tutor] http question

Steven D'Aprano steve at pearwood.info
Sun Nov 9 06:14:23 CET 2014


On Sat, Nov 08, 2014 at 06:12:48PM -0800, Clayton Kirkwood wrote:
> As I move through my learning process, I am wanting to do some http posts,
> etc. I know that there is a http class, 

Do you perhaps the http package (not class)?

https://docs.python.org/3/library/http.html


> but I also am aware of httplib2, but it still seems to be in eternal 
> alpha. 

What leads you to that conclusion? If you're talking about this:

https://github.com/jcgregorio/httplib2

I don't see any sign that it is alpha version software. According to the 
readme file, it is at version 0.8.

I don't see any signs that the author publicly releases any alpha 
or beta versions, they all appear to be ready for production. But if you 
have seen something that suggests otherwise, please point it out, 
because I'm happy to be corrected.


> Which would be better? (However you
> want to define better)

I've never used httplib2, but it seems to be a well-known and often-used 
third-party library under active development. Unfortunately the 
documentation seems a bit mixed, the ref.tex file looks like it hasn't 
been updated since version 0.3 over seven years ago.

If you're intending to open and read from http://... URLs, you shouldn't 
directly use the http library as it is too low-level. Instead you should 
use the urllib library.

https://docs.python.org/3/library/urllib.request.html#module-urllib.request

Sticking to the standard library has the advantage that it is always 
available, but using third-party libraries instead may have the 
advantage that it is better/faster/more featureful/more rapidly updated 
etc.



-- 
Steven


More information about the Tutor mailing list