From fbc5a6a1bb8d8dc1680958cce34776d1b4b13095 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Mon, 16 Apr 2018 17:42:59 +0200 Subject: [PATCH] chg: Store the asn descriptions, if there are changes. --- bgpranking/asn_descriptions.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bgpranking/asn_descriptions.py b/bgpranking/asn_descriptions.py index 274ac31..7518a5f 100644 --- a/bgpranking/asn_descriptions.py +++ b/bgpranking/asn_descriptions.py @@ -17,7 +17,7 @@ class ASNDescriptions(): self.__init_logger(loglevel) self.asn_meta = StrictRedis(unix_socket_path=get_socket_path('storage'), db=2, decode_responses=True) self.logger.debug('Starting ASN History') - self.directory = storage_directory / 'ans_descriptions' + self.directory = storage_directory / 'asn_descriptions' safe_create_dir(self.directory) self.archives = self.directory / 'archive' safe_create_dir(self.archives) @@ -63,4 +63,7 @@ class ASNDescriptions(): p.set('ans_description_last_update', last_modified) p.execute() self.logger.info(f'Done with import. New ASNs: {new_asn}, new descriptions: {new_description}') + if new_asn or new_description: + with open(self.archives / f'{last_modified}.html', 'w') as f: + f.write(r.text) unset_running(self.__class__.__name__)