Skip to main content

Serialization for Requests using JSON.

Project description

# Requestions

Requestions is a serialization library for [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


``` bash
sudo pip install requestions


``` bash
sudo python install

## Usage

``` python
# responses
original_response = requests.get("")
serialized_response = requestions.write_response(original_response)
response = requestions.read_response(serialized_response)

# requests
original_request = requests.models.Request(url="", method="POST")
serialized_request = requestions.write_request(original_request)
request = requestions.read_request(serialized_request)

## 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

def get_current_ip_address(self):
"Abuses some poor sap's ip address detection service."
response = requests.get("")
return response.json()["ip"]

def test_get_current_ip_address(self):
self.assertEqual("", get_current_ip_address())

## Changelog

* 0.0.7 - fix CaseInsensitiveDict problem
* 0.0.5 - fix broken, 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

* [requests-vcr](

## License


Project details

Release history Release notifications

This version
History Node


History Node


History Node


History Node


History Node


History Node


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
requestions-0.0.7.tar.gz (4.2 kB) Copy SHA256 hash SHA256 Source None Aug 5, 2013

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page