Author: poeml Date: Thu Jul 30 04:33:25 2009 New Revision: 65 URL: http://svn.mirrorbrain.org/viewvc/mod_asn?view=revision&revision=65 Log: asn_get_routeviews: - The logic which decided whether to downlaod the routing data snapshot file was fixed. If the script is called and it finds a file which was downloaded less then 8 hours ago, the file is reused. If no file exists or the file is older than 8 hours, it is downloaded again. Modified: trunk/asn_get_routeviews.py Modified: trunk/asn_get_routeviews.py ============================================================================== --- trunk/asn_get_routeviews.py Thu Jul 30 04:25:49 2009 (r64) +++ trunk/asn_get_routeviews.py Thu Jul 30 04:33:25 2009 (r65) @@ -15,12 +15,14 @@ # mirrored daily from archive.routeviews.org, to save routeviews.org the traffic url = 'http://mirrorbrain.org/routeviews/%s' % filename -if not os.path.exists(filename): - print >>sys.stderr, 'downloading', url +if os.path.exists(filename) \ + and (time.time() - os.path.getmtime(filename)) < (60 * 60 * 8): + print >>sys.stderr, 'Using existing file, because it is less than 8h old.' + print >>sys.stderr, 'Remove it to have it downloaded again.' +else: + print >>sys.stderr, 'Downloading', url urllib.urlretrieve(url, filename=filename) -if time.time() - os.path.getmtime(filename) > 60 * 60 * 24 * 7: - sys.exit('File older than 1 week - remove it to have it downloaded again') def gen_open(filenames): _______________________________________________ mirrorbrain-commits mailing list Archive: http://mirrorbrain.org/archive/mirrorbrain-commits/ Note: To remove yourself from this list, send a mail with the content unsubscribe to the address mirrorbrain-commits-request_at_mirrorbrain.orgReceived on Thu Jul 30 2009 - 02:33:26 GMT
This archive was generated by hypermail 2.2.0 : Thu Jul 30 2009 - 02:45:15 GMT