[TIP] Capture HTTP traffic
alfredodeza at gmail.com
Fri Nov 5 06:30:49 PDT 2010
On Fri, Nov 5, 2010 at 9:09 AM, C. Titus Brown <ctb at msu.edu> wrote:
> On Fri, Nov 05, 2010 at 08:38:25AM -0400, Alfredo Deza wrote:
> > On Fri, Nov 5, 2010 at 4:52 AM, Alex <alex.lavoro.propio at gmail.com>
> > > 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.
> > >
> > >
> > I think no one has mentioned it in this thread, but to test our
> > we use
> > TestApp  from WebTest  (by Ian Bicking) which covers most of what
> > mention.
> > All requests are captured, and you can evaluate any parts of the
> > We hook WebTest into the setUp method and we get full isolation from
> > other tests that are running, we even got py.test to run in parallel with
> > this same method achieving total isolation from other tests.
> Hi Alfredo,
> Alex has specified his problem in such a way that WebTest can't solve it,
> unless I'm missing something... WebTest is another Python-specific
> based around WSGI, right?
> Yes WebTest is based around WSGi but as I understood it, Alex mentioned:
"The target to be tested is a C++ application, so Python tools like
wsgi_intercept, twill, mechanize do not apply."
Which doesn't apply (correct me if I am wrong) to a WSGI application
I just don't see how a C++ app would not be able to call it so he can
For example, when we test external API's that do not have a sandbox and we
need to make HTTP calls that return certain responses, we create something
similar to a WSGI app (in some cases we use Bottle) that has WebTest around
it, calls and responses are captured no matter where you are starting the
But then again, I might be wrong applying those solutions to Alex's problem
> C. Titus Brown, ctb at msu.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the testing-in-python