aboutsummaryrefslogtreecommitdiffstats
path: root/lang/python/examples/howto/pmkey-import-hkp.py
diff options
context:
space:
mode:
authorBen McGinnes <[email protected]>2018-12-13 18:17:10 +0000
committerBen McGinnes <[email protected]>2018-12-13 18:17:10 +0000
commit4308d172816f3172454fac1dc0771014056764a1 (patch)
treef585387752db56676b0f6252f57f7bf11a973912 /lang/python/examples/howto/pmkey-import-hkp.py
parentpython: new example script (diff)
downloadgpgme-4308d172816f3172454fac1dc0771014056764a1.tar.gz
gpgme-4308d172816f3172454fac1dc0771014056764a1.zip
python: examples bugfix
* Fixed a bug in the ProtonMail importers (pmkey-*.py) where multiple keys found for a username would always result in the last email address checked being returned in the printed output for all located keys.
Diffstat (limited to 'lang/python/examples/howto/pmkey-import-hkp.py')
-rwxr-xr-xlang/python/examples/howto/pmkey-import-hkp.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/lang/python/examples/howto/pmkey-import-hkp.py b/lang/python/examples/howto/pmkey-import-hkp.py
index 3b9345f4..1a11b4af 100755
--- a/lang/python/examples/howto/pmkey-import-hkp.py
+++ b/lang/python/examples/howto/pmkey-import-hkp.py
@@ -110,10 +110,16 @@ for result in results:
new_uids = result.new_user_ids
new_scrt = result.secret_imported
nochange = result.unchanged
+
+ def knom():
+ for ki in result.imports:
+ for ku in c.get_key(ki.fpr).uids:
+ return ku.uid
+
print("""
The total number of keys considered for import was: {0}
-With UIDs wholely or partially matching the following string:
+With UIDs wholely or partially matching the following string(s):
{1}
@@ -125,7 +131,7 @@ Number of new secret keys: {6}
Number of unchanged keys: {7}
The key IDs for all considered keys were:
-""".format(num_keys, k, new_revs, new_sigs, new_subs, new_uids, new_scrt,
+""".format(num_keys, knom(), new_revs, new_sigs, new_subs, new_uids, new_scrt,
nochange))
for i in range(num_keys):
print(result.imports[i].fpr)