Requests: A Painless HTTP Client for Python
Join the DZone community and get the full member experience.Join For Free
I’ve always thought that making HTTP requests in Python was a lot harder than it should’ve been. Alone, the confusion between urllib and urllib2 is enough to drive me a little crazy. On top of that, neither library has that API je ne sais quoi, the “just works” feeling.
>>> r = requests.get('https://api.github.com', auth=('user', 'pass')) >>> r.status_code 204 >>> r.headers['content-type'] 'application/json'
This looks much better than what I’m used to. I think we’ll start using Requests when we need an HTTP client for Fiesta. Does anybody have any experience (good or bad) with it? Is there some other library we should be taking a look at as well, once we’ve committed to moving on from the stdlib?
Opinions expressed by DZone contributors are their own.