python: hkp key importer

* Tweaked it slightly to avoid repetition of key searches when there
  is only one search pattern to check (i.e. usually a single key ID or
  fingerprint).
This commit is contained in:
Ben McGinnes 2018-12-11 09:55:15 +11:00
parent 2e7a14c9b3
commit 772b5aae24

View File

@ -58,7 +58,7 @@ if pattern is not None:
if keyed is True:
try:
fob = server.search(pattern)
except:
except Exception as e:
fob = None
if fob is not None:
keys.append(fob[0])
@ -68,6 +68,7 @@ if pattern is not None:
pass
for logrus in pattern.split():
if logrus != pattern:
try:
key = server.search(hex(int(logrus, 16)))
hexed = True
@ -80,7 +81,7 @@ if pattern is not None:
if hexed is True:
try:
fob = server.search(logrus)
except:
except Exception as e:
fob = None
if fob is not None:
keys.append(fob[0])
@ -88,6 +89,10 @@ if pattern is not None:
pass
else:
pass
else:
pass
else:
pass
if len(keys) > 0: