I have a cgi script wrote in Python that is receiving some complex http request, one that could be POST or GET.
I am looking for a simple way to log the request in some way so I can replay it later any number of times I want.
Seems you're looking to cache queries made to your site. 
After calculating a response, save a record with the request url, method, params, and response in a your preferred storage.
Depending on your environment and the number of requests, your may choose a database or filesystem. 
However, you need to take into account that some of the result data may change, in which case you'd need to remove cached data that depend on that data.
How can I save a HTTP request from a python cgi scripts so I can easily repeat it?