From 1b9d30db089e9de3ef859195ad58d2164a0231a0 Mon Sep 17 00:00:00 2001 From: Ben McGinnes Date: Tue, 6 Nov 2018 14:11:01 +1100 Subject: python examples: protonmail hkp scripts * fixed a bug in the import try statement for both versions. --- lang/python/examples/howto/pmkey-import-hkp-alt.py | 25 ++++++++++------------ 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'lang/python/examples/howto/pmkey-import-hkp-alt.py') 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: -- cgit v1.2.3