[TIP] Capture HTTP traffic

Alex alex.lavoro.propio at gmail.com
Fri Nov 5 01:52:49 PDT 2010

Being the test target is a C++ application (or whichever foreign
language the access to source code is not available), we first exclude
Pythonic http libraries.

I prefer not to hijack host configuration, use a proxy, or mock the
server, since they either result in a lot of work, and difficult to be
deployed in a CI server like Hudson, in which the test are not only
run automatically, but the "setup" (hijack host file) and "restore" of
the test environment is also preferably done automatically.

The best solution would be a high-level (HTTP-level) Python
module/wrapper for 'pycap', which operates in 'packet' level. This
said module use pycap to capture and filter HTTP requests and returns
the result in a more Pythonic data structures. This module should
start a thread which captures HTTP requests while the test case is
being executed.

I cannot find anything which does what I've just describe. Please
correct if I am wrong.


More information about the testing-in-python mailing list