This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Python HTTP Library that's actually usable.

Project Description

Most existing Python modules for dealing HTTP requests are insane. I have to look up everything that I want to do. Most of my worst Python experiences are a result of the various built-in HTTP libraries (yes, even worse than Logging).

But this one’s different. This one’s going to be awesome. And simple.

Really simple.

Features

  • Extremely simple GET, HEAD, POST, PUT, DELETE Requests
    • Simple HTTP Header Request Attachment
    • Simple Data/Params Request Attachment
  • Simple Basic HTTP Authentication
    • Simple URL + HTTP Auth Registry

Usage

It couldn’t be simpler.

>>> import requests
>>> r = requests.get('http://google.com')

HTTPS? Basic Authentication?

>>> r = requests.get('https://convore.com/api/account/verify.json')
>>> r.status_code
401

Uh oh, we’re not authorized! Let’s add authentication.

>>> conv_auth = requests.AuthObject('requeststest', 'requeststest')
>>> r = requests.get('https://convore.com/api/account/verify.json', auth=conv_auth)

>>> r.status_code
200

>>> r.headers['content-type']
'application/json'

>>> r.content
'{"username": "requeststest", "url": "/users/requeststest/", "id": "9408", "img": "censored-long-url"}'

API

Requests:

All request functions return a Response object (see below).

GET Requests
>>> request.get(url, params={}, headers={} auth=None)
<request object>
HEAD Requests
>>> request.head(url, params={}, headers={} auth=None)
<request object>
PUT Requests
>>> request.put(url, data='', headers={}, auth=None)
<request object>
POST Requests
>>> request.post(url, data={}, headers={}, auth=None)
<request object>
DELETE Requests
>>> request.delete(url, params={}, headers={}, auth=None)
<request object>

Responses:

Request.status_code:
(Integer) Received HTTP Status Code Response
Request.headers:
(Dictionary) Received HTTP Response Headers
Request.content:
(Bytes) Received Content

HTTP Authentication Registry:

You can register AuthObjects to automatically enable HTTP Authentication on requests that contain a registered base URL string.

>>> requests.add_autoauth(url, authobject)

Installation

To install requests, simply:

$ pip install requests

Or, if you absolutely must:

$ easy_install requests

But, you really shouldn’t do that.

Contribute

If you’d like to contribute, simply fork the repository, commit your changes to the develop branch (or branch off of it), and send a pull request. Make sure you add yourself to AUTHORS.

Roadmap

  • Sphinx Documentation
  • Exhaustive Unittests

History

0.2.0 (2011-02-14)

  • Birth!

0.0.1 (2011-02-13)

  • Frustration
  • Conception
Release History

Release History

History Node

2.18.1

History Node

2.18.0

History Node

2.17.3

History Node

2.17.2

History Node

2.17.1

History Node

2.17.0

History Node

2.16.5

History Node

2.16.4

History Node

2.16.3

History Node

2.16.2

History Node

2.16.1

History Node

2.16.0

History Node

2.15.1

History Node

2.15.0

History Node

2.14.2

History Node

2.14.1

History Node

2.14.0

History Node

2.13.0

History Node

2.12.5

History Node

2.12.4

History Node

2.12.3

History Node

2.12.2

History Node

2.12.1

History Node

2.12.0

History Node

2.11.1

History Node

2.11.0

History Node

2.10.0

History Node

2.9.2

History Node

2.9.1

History Node

2.9.0

History Node

2.8.1

History Node

2.8.0

History Node

2.7.0

History Node

2.6.2

History Node

2.6.1

History Node

2.6.0

History Node

2.5.3

History Node

2.5.2

History Node

2.5.1

History Node

2.5.0

History Node

2.4.3

History Node

2.4.2

History Node

2.4.1

History Node

2.4.0

History Node

2.3.0

History Node

2.2.1

History Node

2.2.0

History Node

2.1.0

History Node

2.0.1

History Node

2.0.0

History Node

1.2.3

History Node

1.2.2

History Node

1.2.1

History Node

1.2.0

History Node

1.1.0

History Node

1.0.4

History Node

1.0.3

History Node

1.0.2

History Node

1.0.1

History Node

1.0.0

History Node

0.14.2

History Node

0.14.1

History Node

0.14.0

History Node

0.13.9

History Node

0.13.8

History Node

0.13.7

History Node

0.13.6

History Node

0.13.5

History Node

0.13.4

History Node

0.13.3

History Node

0.13.2

History Node

0.13.1

History Node

0.13.0

History Node

0.12.1

History Node

0.12.01

History Node

0.12.0

History Node

0.11.2

History Node

0.11.1

History Node

0.10.8

History Node

0.10.7

History Node

0.10.6

History Node

0.10.4

History Node

0.10.3

History Node

0.10.2

History Node

0.10.1

History Node

0.10.0

History Node

0.9.3

History Node

0.9.2

History Node

0.9.1

History Node

0.9.0

History Node

0.8.9

History Node

0.8.8

History Node

0.8.7

History Node

0.8.6

History Node

0.8.5

History Node

0.8.4

History Node

0.8.3

History Node

0.8.2

History Node

0.8.1

History Node

0.8.0

History Node

0.7.6

History Node

0.7.5

History Node

0.7.4

History Node

0.7.3

History Node

0.7.2

History Node

0.7.1

History Node

0.7.0

History Node

0.6.6

History Node

0.6.5

History Node

0.6.4

History Node

0.6.3

History Node

0.6.2

History Node

0.6.1

History Node

0.6.0

History Node

0.5.1

History Node

0.5.0

History Node

0.4.1

History Node

0.4.0

History Node

0.3.4

History Node

0.3.3

History Node

0.3.2

History Node

0.3.1

History Node

0.3.0

History Node

0.2.4

History Node

0.2.3

History Node

0.2.2

History Node

0.2.1

This version
History Node

0.2.0

History Node

0.0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
requests-0.2.0.tar.gz (5.5 kB) Copy SHA256 Checksum SHA256 Source Feb 14, 2011

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting