From 04c22dd56efd137a1205b840fc83976910a0eb94 Mon Sep 17 00:00:00 2001 From: Nicolas Dandrimont Date: Mon, 4 Sep 2017 17:41:54 +0200 Subject: [PATCH] lister_base: when storing responses for debugging, use a timestamp as filename --- swh/lister/core/lister_base.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/swh/lister/core/lister_base.py b/swh/lister/core/lister_base.py index 866b201..8dfcee7 100644 --- a/swh/lister/core/lister_base.py +++ b/swh/lister/core/lister_base.py @@ -482,13 +482,13 @@ class SWHListerBase(abc.ABC, config.SWHConfig): Returns: nothing """ - def escape_url_path(p): - return p.replace('/', '__') + datepath = utcnow().isoformat() fname = os.path.join( - self.config['cache_dir'], - escape_url_path(response.request.path_url) + '.gz' - ) + self.config['cache_dir'], + datepath + '.gz', + ) + with gzip.open(fname, 'w') as f: f.write(bytes( self.transport_response_to_string(response),