From 95c836bc8a3b8b6a85dab500eeb80f03b16721b2 Mon Sep 17 00:00:00 2001 From: Ian Young Date: Mon, 7 Nov 2016 14:07:13 +0000 Subject: [PATCH] Enable named file analysis for by_registrar.py --- charting/by_registrar.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/charting/by_registrar.py b/charting/by_registrar.py index eeb9cb61..c79c9ea0 100755 --- a/charting/by_registrar.py +++ b/charting/by_registrar.py @@ -8,6 +8,7 @@ from xml.dom.minidom import parse from urllib import urlopen from datetime import date +import sys REGISTRAR_NAME = { @@ -76,11 +77,14 @@ def display(infile, split): print "%10s: %d" % (e[0], e[1]) print "%10s: %d" % ("other", sum([e[1] for e in rest_counts])) -cache_file = date.today().strftime("cache/%Y-%m.xml") -print "Most recent monthly UK federation production aggregate (%s):" % (cache_file) -display(cache_file, 9) +if len(sys.argv) == 2: + display(sys.argv[1], 9) +else: + cache_file = date.today().strftime("cache/%Y-%m.xml") + print "Most recent monthly UK federation production aggregate (%s):" % (cache_file) + display(cache_file, 9) -print + print -print "Current eduGAIN production aggregate:" -display(urlopen("http://mds.edugain.org/"), 9) + print "Current eduGAIN production aggregate:" + display(urlopen("http://mds.edugain.org/"), 9)