[TIP] Capture HTTP traffic

Olemis Lang olemis at gmail.com
Wed Nov 3 06:59:35 PDT 2010


On Wed, Nov 3, 2010 at 5:10 AM, Alex <alex.lavoro.propio at gmail.com> wrote:
> I am developing an automated test in Python/Windows and I have to
> ensure certain HTTP requests are made and verify the GET parameters
> and responses. I need a tool to help me easily to capture and filter
> the HTTP requests.
>
> A typical test case is like:
>
>    def setUp()
>        self.capture = HttpCapture() # hypothetic
>    def testFoo(self):
>        self.capture.start("http://update.foobar.com")
>        subprocess.Popen(...)
>        self.capture.end()
>        # suppose self.capture.result() returns a list of strings,
> containing the URLs
>        # have been visited betwen begin() and end()
>        self.failUnless("http://update.foobar.com/" in
> self.capture.result() )
>

Your question may be related to several scenarios where the goal is
always the same , but the way to solve it may vary . Here are
suggestions

Fiddler : A really good proxy for dev-ing with scripting
               support (Python ?) , pause , stop , replay ,
               request builder, plugin system,
               programmatic API ... for Windows
               AFAIK (if you find a -multiplatform ?-
               FOSS alternative please let me know)

wsgi_intercept : To intercept HTTP requests

twill | mechanize : For high-level HTTP commands (and more ...)

Integrating pycap is really not trivial, IMO .

Probably I didn't understand your original question . If that's the
case , please tell so that we can refine the answer .

-- 
Regards,

Olemis.

Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/

Featured article:



More information about the testing-in-python mailing list