diff requestdumpster/dumpster.py @ 15:d2585c78e70f

make -d actually work
author Jeff Hammel <k0scist@gmail.com>
date Fri, 12 Aug 2016 13:44:49 -0700
parents 194a66d765ae
children 9ef205ebb047
line wrap: on
line diff
--- a/requestdumpster/dumpster.py	Wed Jun 01 09:09:28 2016 -0700
+++ b/requestdumpster/dumpster.py	Fri Aug 12 13:44:49 2016 -0700
@@ -36,6 +36,11 @@
         lines.append(request.body)
         body = '\r\n'.join(lines)
 
+        if self.directory:
+            filename = '{0}'.format(time.time())
+            with open(os.path.join(self.directory, filename), 'w') as f:
+                f.write(body)
+
         response = Response(content_type='text/plain',
                             body=body)
         return response(environ, start_response)