python examples: another importer

* Fixed a similar type of bug with the non-protonmail importer.
This commit is contained in:
Ben McGinnes 2018-11-06 14:58:15 +11:00
parent 1b9d30db08
commit 0cb625da84

View File

@ -45,7 +45,10 @@ else:
try: try:
keys = server.search(pattern) keys = server.search(pattern)
print("Found {0} key(s).".format(len(keys))) if keys is not None:
print("Found {0} key(s).".format(len(keys)))
else:
pass
except Exception as e: except Exception as e:
keys = [] keys = []
for logrus in pattern.split(): for logrus in pattern.split():
@ -56,9 +59,10 @@ except Exception as e:
keys.append(key[0]) keys.append(key[0])
print("Found {0} key(s).".format(len(keys))) print("Found {0} key(s).".format(len(keys)))
for key in keys: if keys is not None:
import_result = c.key_import(key.key_blob) for key in keys:
results.append(import_result) import_result = c.key_import(key.key_blob)
results.append(import_result)
for result in results: for result in results:
if result is not None and hasattr(result, "considered") is False: if result is not None and hasattr(result, "considered") is False: