HTTReplay: a Python HTTP Recording Library

Are your integration tests moving at a snail’s pace? Is test suite performance getting you down?

Good news: I’m here to tell you about httreplay, a tiny new Python library that makes it a snap to record and replay HTTP requests.

How easy is it, you ask? This easy:

from httreplay import replay

with replay('recording.json'):
    response = requests.get('http://example.com/')
    # ... issue as many requests as you like ...
    # ... repeat requests won't hit the network ...

Surely there must be a catch, you object? No ma’am. httreplay works with HTTP and HTTPS. It patches all your favorite libraries, like httplib, requests >= 1.2.3, and urllib3 >= 1.6.0. What’s more, it’s trivial to install: just pip install httreplay and start manipulating web requests like the champion you are.

Perhaps your needs are a little more involved? Never fear: httreplay slices and dices, too. Need to filter out sensitive or inconsequential information from your URLs, request bodies, or request headers? httreplay gives you all the hooks you need to get the job done:

from httreplay import replay, filter_query_params_key

with replay('r.json', url_key=filter_query_params_key(['apiKey'])):
    response = requests.get('https://example.com/?apiKey=SEKRET')

But wait, there’s more! Act now and we’ll throw in mercifully readable documentation, including an example Django test base class, that will get you up and running in no time.

Best of all, httreplay is available for the low, low price of $0. That’s right: nothing, nada. It’s MIT licensed and available on GitHub today!