Skip to content

Instantly share code, notes, and snippets.

View danielsoneg's full-sized avatar

Eric Danielson danielsoneg

View GitHub Profile
@danielsoneg
danielsoneg / capture.py
Created October 29, 2020 00:05
capture.py: Capture HTTP requests for replay
"""capture.py: Capture HTTP requests for replay
This script provides a function that listens for an HTTP request on the given
address and port, captures that request, and generates a urllib Request object
by which the request can be replayed against a different server. This server
always responds with 200 and an empty body. Returning other responses is left
as an exercise for the reader.
This is designed to use just the python built-ins and to be useable from a
REPL.

Keybase proof

I hereby claim:

  • I am danielsoneg on github.
  • I am egd (https://keybase.io/egd) on keybase.
  • I have a public key whose fingerprint is 8873 132B C81A F161 9133 22A2 8132 E4E9 82D2 45A6

To claim this, I am signing this object: