From b46deb1417dc3596e9ac9fe2fe8cc0b7f42457e7 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Mon, 26 Oct 2015 06:29:00 +0000 Subject: "Any programmer who fails to comply with the standard naming, formatting, or commenting conventions should be shot. If it so happens that it is inconvenient to shoot him, then he is to be politely requested to recode his program in adherence to the above standard." -- Michael Spier, Digital Equipment Corporation svn path=/branches/tk705/; revision=6152 --- potpourri/rrdp-fetch.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'potpourri/rrdp-fetch.py') diff --git a/potpourri/rrdp-fetch.py b/potpourri/rrdp-fetch.py index 469c0c9f..b8d927ee 100755 --- a/potpourri/rrdp-fetch.py +++ b/potpourri/rrdp-fetch.py @@ -29,25 +29,25 @@ from urlparse import urlparse from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter class BadHash(Exception): - "Calculated hash value doesn't match expected hash value." + "Calculated hash value doesn't match expected hash value." def fetch(elt): - uri = elt.get("uri") - hash = elt.get("hash").lower() - print "Fetching", uri + uri = elt.get("uri") + hash = elt.get("hash").lower() + print "Fetching", uri - text = urlopen(uri).read() - h = sha256(text).encode("hex") - if h != hash: - raise BadHash("Bad hash for %s: expected %s got %s" % (uri, hash, h)) + text = urlopen(uri).read() + h = sha256(text).encode("hex") + if h != hash: + raise BadHash("Bad hash for %s: expected %s got %s" % (uri, hash, h)) - xml = XML(text) - rrdp.schema.assertValid(xml) + xml = XML(text) + rrdp.schema.assertValid(xml) - u = urlparse(uri) - fn = u.netloc + u.path + u = urlparse(uri) + fn = u.netloc + u.path - return elt, xml, fn + return elt, xml, fn parser = ArgumentParser(description = __doc__, formatter_class = ArgumentDefaultsHelpFormatter) parser.add_argument("uri", nargs = "?", @@ -65,4 +65,4 @@ deltas = [fetch(elt) for elt in updates.findall(rrdp.xmlns + "delta")] print updates print snapshot for delta in deltas: - print delta + print delta -- cgit v1.2.3