Skip to main content
# 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)

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

## 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("http://jsonip.com")
return response.json()["ip"]

@httpetrified("samples/helpers/jsonip-request.json")
def test_get_current_ip_address(self):
self.assertEqual("127.0.0.1", get_current_ip_address())
```

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

* [requests-vcr](https://github.com/sigmavirus24/requests-vcr)

## License

BSD.

Metadata

Release files for requestions 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for requestions 0.0.7
File Size Uploaded
requestions-0.0.7.tar.gz 4.2 kB Details

Release files / requestions-0.0.7.tar.gz

Download URL requestions-0.0.7.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f3edb33191d60de2158d3dba31e420cd7ccc4f348f2f8d89c4fad48897e844bb
BLAKE2b-256 checksum
How to use checksums
92864a9c1ebcd29935c62a3f2f3b9a5bf19ea1a87736d4213220dc5514c6188f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.7 This release

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page