aboutsummaryrefslogtreecommitdiffstats
path: root/lang/python/examples/howto/pmkey-import-hkp-alt.py
diff options
context:
space:
mode:
authorBen McGinnes <[email protected]>2018-11-06 03:11:01 +0000
committerBen McGinnes <[email protected]>2018-11-06 03:11:01 +0000
commit1b9d30db089e9de3ef859195ad58d2164a0231a0 (patch)
tree824a165748e265e2852d0d86a38983ccb17238bf /lang/python/examples/howto/pmkey-import-hkp-alt.py
parentgpg: Avoid error diagnostics with --override-session-key. (diff)
downloadgpgme-1b9d30db089e9de3ef859195ad58d2164a0231a0.tar.gz
gpgme-1b9d30db089e9de3ef859195ad58d2164a0231a0.zip
python examples: protonmail hkp scripts
* fixed a bug in the import try statement for both versions.
Diffstat (limited to 'lang/python/examples/howto/pmkey-import-hkp-alt.py')
-rwxr-xr-xlang/python/examples/howto/pmkey-import-hkp-alt.py25
1 files changed, 11 insertions, 14 deletions
diff --git a/lang/python/examples/howto/pmkey-import-hkp-alt.py b/lang/python/examples/howto/pmkey-import-hkp-alt.py
index 673fe62e..859de03b 100755
--- a/lang/python/examples/howto/pmkey-import-hkp-alt.py
+++ b/lang/python/examples/howto/pmkey-import-hkp-alt.py
@@ -123,20 +123,17 @@ for keyterm in keyterms:
for k in ksearch:
print("Checking for key for: {0}".format(k))
- try:
- keys = server.search(k)
- if isinstance(keys, list) is True:
- for key in keys:
- allkeys.append(key)
- try:
- import_result = c.key_import(key.key_blob)
- except Exception as e:
- import_result = c.key_import(key.key)
- else:
- paradox.append(keys)
- import_result = None
- except Exception as e:
- import_result = None
+ import_result = None
+ keys = server.search(k)
+ if isinstance(keys, list) is True:
+ for key in keys:
+ allkeys.append(key)
+ try:
+ import_result = c.key_import(key.key_blob)
+ except Exception as e:
+ import_result = c.key_import(key.key)
+ else:
+ paradox.append(keys)
results.append(import_result)
for result in results: