Home > fedora, foss, fun, Packaging, python > New Package: Python-requests – HTTP for Humans

New Package: Python-requests – HTTP for Humans

According to http://docs.python-requests.org/en/latest/index.html

Most existing Python modules for sending HTTP requests are extremely verbose and cumbersome. Python’s builtin urllib2 module provides most of the HTTP capabilities you should need, but the api is thoroughly broken. It requires an enormous amount of work (even method overrides) to perform the simplest of tasks.

Things shouldn’t be this way. Not in Python

Sample code

>>> r = requests.get(‘https://api.github.com’, auth=(‘user’, ‘pass’))
>>> r.status_code
204
>>> r.headers['content-type']
‘application/json’
>>> r.content

The same sample , without using requests would look like https://gist.github.com/973705. Requests library indeed reduces the lines of code we have to write to set up HTTP requests.

The new library is available as python-requests in  Fedora. You can test the packaging using the following command

yum –enablerepo=updates-testing install python-requests

Have fun!

About these ads
Categories: fedora, foss, fun, Packaging, python Tags: , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 894 other followers

%d bloggers like this: