Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install requestions

How to install requestions

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install requestions
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
Windows (64-bit)
Mac OS X (10.5+)
Linux (32-bit)
Linux (64-bit)
0.0.7 Available View build log
0.0.7 Available View build log
 
Author
License
BSD
Imports
Lastest release
version 0.0.7 on Sep 20th, 2013

# Requestions

Requestions is a serialization library for [Requests](https://github.com/kennethreitz/requests) using JSON. Also, requestions includes a decorator called httpetrified for storing responses and replaying them in the future for HTTP testing without the live interwebz.

## Installing

Simple.

` bash sudo pip install requestions `

or,

` bash sudo python setup.py install `

## Usage

``` python # responses original_response = requests.get("http://httpbin.org/get") serialized_response = requestions.write_response(original_response) response = requestions.read_response(serialized_response)

System Message: WARNING/2 (<string>, line 21); backlink

Inline literal start-string without end-string.

# requests original_request = requests.models.Request(url="http://httpbin.org/post", method="POST") serialized_request = requestions.write_request(original_request) request = requestions.read_request(serialized_request) ```

System Message: WARNING/2 (<string>, line 27); backlink

Inline literal start-string without end-string.

System Message: WARNING/2 (<string>, line 27); backlink

Inline interpreted text or phrase reference start-string without end-string.

## Decorator

Save responses in a json file, then use them later to make unit testing not so miserable.

``` python import json import requests from requestions import httpetrified

System Message: WARNING/2 (<string>, line 37); backlink

Inline literal start-string without end-string.
def get_current_ip_address(self):
"Abuses some poor sap's ip address detection service." response = requests.get("http://jsonip.com") return response.json()["ip"]

@httpetrified("samples/helpers/jsonip-request.json") def test_get_current_ip_address(self):

System Message: ERROR/3 (<string>, line 49)

Unexpected indentation.
self.assertEqual("127.0.0.1", get_current_ip_address())

System Message: WARNING/2 (<string>, line 50)

Block quote ends without a blank line; unexpected unindent.

```

System Message: WARNING/2 (<string>, line 50); backlink

Inline literal start-string without end-string.

System Message: WARNING/2 (<string>, line 50); backlink

Inline interpreted text or phrase reference start-string without end-string.

## Changelog

  • 0.0.7 - fix CaseInsensitiveDict problem
  • 0.0.5 - fix broken setup.py, gah
  • 0.0.4 - fix test for both requests==0.14.2 and requests>=1.0.3
  • 0.0.3 - httpetrified decorator
  • 0.0.1 - initial commit

## Alternatives

## License

BSD.

Subscribe to package updates

Last updated Sep 20th, 2013

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.