Live data from Hacker News

Python Requests: HTTP for Humans

python-requests.org

81–86 of 86 posts

Re: Python Requests: HTTP for Humans

#81
post #66

Earlier quoted context omitted.

- It's too low level for quick stuff - It handles HTTP basic auth wrong - It throws an exception, AN EXCEPTION, for any response that isn't 2xx - Async is an ugly mess - In love with streams - Horribly inconsistent across framework profiles - ServicePointManager.Expect100Continue - Inconsistent header handling and restrictions - Terrible cookie API

I think it's fine for simple scenarios (i.e. plain GET), but it breaks down in a hurry and the fact that you have to read out of the response stream is real overhead.

It's not fine for a plain GET, it's awful.

I'm still surprised every time I use it that they've not released a modern library for it in .Net.

Re: Python Requests: HTTP for Humans

#82
post #66

Earlier quoted context omitted.

Just out of curiosity, what's so awful about WebRequest? I've been using it for years for various things and never really had a problem with it.

- It's too low level for quick stuff - It handles HTTP basic auth wrong - It throws an exception, AN EXCEPTION, for any response that isn't 2xx - Async is an ugly mess - In love with streams - Horribly inconsistent across framework profiles - ServicePointManager.Expect100Continue - Inconsistent header handling and restrictions - Terrible cookie API

The async handling was the deal breaker for me. I gritted my teeth through the other stuff but finally gave up at that point.

Re: Python Requests: HTTP for Humans

#83

I don't mean to badmouth Requests or Python in general, it certainly looks like an improvement, but can anyone enlighten me as to why an API that wraps an HTTP request with concise methods is #1 on HN, twice? This looks more like a good answer to SO question than "news". This looks like all the other wrapper methods you spend 5 minutes doing, once, when you start a new codebase?

The philosophy of Python is that those wrapper methods shouldn't be necessary. I'm glad when language quirks and libraries get linked, it's good for discussion. (And more informative than a good third of the stuff that gets linked.)

I couldn't agree more.

I gave a talk about this very thing at PyCodeConf this week. Here are the slides: http://python-for-humans.heroku.com

Re: Python Requests: HTTP for Humans

#84

Although Requests looks very nice, I've wondered why most people wouldn't simply use pycurl - http://pycurl.sourceforge.net/ ? It's stable and you get all the power that cURL has (which is a lot), and the API is fairly simple - although maybe not as pythonic as the Requests API is. On a side note: last time I checked urllib2 (which actually drives Requests) could not do SSL requests over a proxy, which gave me the fe…

I'm moving off of urllib2 as we speak, to sit directly on top of httplib.

One thing at a time :)

Re: Python Requests: HTTP for Humans

#85
post #55

How does this compare (feature wise) to the poster library? Are they about the same? I've used poster some, but not requests... I'll have to try it now. Just curious how it compares to poster.

The current stable release actually has poster inside (and has for a while), but it's being taken out soon.

Re: Python Requests: HTTP for Humans

#86
Trying to use the requests module yields:

  File "/usr/lib/python2.6/cookielib.py", line 38, in 
    from calendar import timegm
ImportError: cannot import name timegm

for me.

On two different machines, one OSX SL with Python 2.6 from MacPorts and the other Ubuntu 10.04.3 LTS with Python 2.6 via aptitude.

Can not find any solution for this via Google and its siblings.

I'm stuck :(

-jsl

Post reply on HN