This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!
Project Description

This package lets you record all the requests and responses of an application, and then create a doctest from that. (There’s no real reason it couldn’t be a unit test… just haven’t written that yet.)

The recorder is a piece of middleware. You use it like this:

from webtestrecorder import record_file

app = ... instantiate app ...
app = record_file(app, '/tmp/record.txt')

All requests and responses will be written to this file. You can read them out like so:

from webtestrecorder import get_records

records = get_records(open('/tmp/record.txt', 'rb'))

records is a list of requests, and each request has a .response attribute. You can then create a test:

from webtestrecorder import write_doctest

write_doctest(records, open('/tmp/doctest.txt', 'wb'))

You can also use this like a shell script:

$ python -m webtestrecorder < /tmp/record.txt > /tmp/doctest.txt

Apache Logs

You can read requests and responses from Apache logs via webtestrecorder.apachelog.parse_apache_log(). A constraint of this is that request bodies won’t be present, and responses just have a status code and Content-Length, the Content-Type is unknown and the body is padded with null bytes.

Rerunning requests

The module webtestrecorder.http can take a list of requests/responses and send them to a server, effectively replaying requests. This is also a command-line program usable like:

$ python -m webtestrecorder.http apache_access.log --host localhost:8000

You can filter or rewrite these requests with a custom filter function. See python -m webtestrecorder.http -h for more.

News

0.1.1

  • Packaging fixes

0.1

  • Initial release
Release History

Release History

0.1.1

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
WebTestRecorder-0.1.1.tar.gz (13.7 kB) Copy SHA256 Checksum SHA256 Source Nov 10, 2011

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting