skip to navigation
skip to content

requestests 1.2.2

Python HTTP Tests for Humans.

# Requestests

This is an testing/validation extension on top of the ever-so-popular [requests library]( The library relies on duck typing to add testability of a response object. Given that, leveraging the validation mechanism in requestests is both lightweight and simple!

## Installation

The library can be installed via:

pip install requestests

## Usage

Using the built-in validations in requestests is intended to be an extremely intuitive extension of using requests:

>>> import requestests
>>> r = requestests.get('', auth=('user', 'pass'))
>>> r.validate_code(requests.code.ok)
>>> r.validate_header_like('Content-Type', 'application/json')
>>> r.encoding
>>> r.text
>>> r.json()
{u'disk_usage': 368627, u'private_gists': 484, ...}

What is happening is that the assertion operation is being abstracted out. The traditional method of asserting on the response:

r = requests.get(‘’) assert r.status_code ==, “Expecting a 200 response code”

can be simplified to this:

r = requestests.get(‘’) r.validate_code(requests.code.ok)

## Or even to this r = requestests.get(‘’).validate_code(requests.code.ok)

Validations follow the builder paradigm, so operations can be chained together:

entity = requestests.get(‘’)
.validate_code(requests.code.ok) .validate_header_like(‘Content-Type’, ‘application/json’) .json()

What happens in this scenario is that if any of the validations fails, an AssertionError is raised; otherwise, at the end of this requests, you would have:

  1. Validated that the request was successful
  2. Validated the ‘Content-Type’ is ‘application/json’
  3. and deserialized the response.text

## Documentation

The projects homepage can be found [here](

## Package Dependencies:

# Copyright

Copyright (c) 2016 Peter Salas. See LICENSE for further details.

Release History

### 1.2.2 (2017-01-09)

New Features

  • Fixing major issue with installing requestests v1.2.1 from PyPi server

### 1.2.1 (2017-01-09)

New Features

  • Fixing major issue with installing requestests v1.2.0 from PyPi server
  • Updates to licensing information

### 1.2.0 (2016-11-16)

New Features

  • Migration of ownership to personal Github account for continued support and enhancements
  • Update of documentation for easier readability on both github and pypi
  • Development enhancements to use virtualenv versus system python environment

### 1.1.2 (2016-09-29)

New Features

  • A more comprehensive set of Validation methods for evaluating things like (i) response codes, (ii) response content, (iii) response headers, and (iv) time-to-last-byte (ttlb)
  • Adding better assertion debug messages for determining what failed and why. For example: - 200 == 301, which basically means that the request to failed because we were expecting 200 but got a 301
  • Adding several unit-tests for ensuring the code continues to work

### 1.0.0 (2016-06-01)

New Features

  • First release of requestests testing tool for the world
File Type Py Version Uploaded on Size
requestests-1.2.2.tar.gz (md5) Source 2017-01-09 8KB