comparison 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
comparison
equal deleted inserted replaced
14:194a66d765ae 15:d2585c78e70f
34 for header in request.headers.items()]) 34 for header in request.headers.items()])
35 lines.append('') 35 lines.append('')
36 lines.append(request.body) 36 lines.append(request.body)
37 body = '\r\n'.join(lines) 37 body = '\r\n'.join(lines)
38 38
39 if self.directory:
40 filename = '{0}'.format(time.time())
41 with open(os.path.join(self.directory, filename), 'w') as f:
42 f.write(body)
43
39 response = Response(content_type='text/plain', 44 response = Response(content_type='text/plain',
40 body=body) 45 body=body)
41 return response(environ, start_response) 46 return response(environ, start_response)
42 47
43 def main(args=sys.argv[1:]): 48 def main(args=sys.argv[1:]):