aboutsummaryrefslogtreecommitdiff
path: root/potpourri/rrdp-fetch.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2015-10-26 06:29:00 +0000
committerRob Austein <sra@hactrn.net>2015-10-26 06:29:00 +0000
commitb46deb1417dc3596e9ac9fe2fe8cc0b7f42457e7 (patch)
treeca0dc0276d1adc168bc3337ce0564c4ec4957c1b /potpourri/rrdp-fetch.py
parent397beaf6d9900dc3b3cb612c89ebf1d57b1d16f6 (diff)
"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
Diffstat (limited to 'potpourri/rrdp-fetch.py')
-rwxr-xr-xpotpourri/rrdp-fetch.py28
1 files changed, 14 insertions, 14 deletions
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