diff options
author | Ben McGinnes <[email protected]> | 2018-11-06 03:58:15 +0000 |
---|---|---|
committer | Ben McGinnes <[email protected]> | 2018-11-06 03:58:15 +0000 |
commit | 0cb625da84d7e5deeacad113c404a8bc2154c8e7 (patch) | |
tree | 0858f8b8250e6a2ed72ab241da265103968c7e00 /lang/python/examples/howto/import-keys-hkp.py | |
parent | python examples: protonmail hkp scripts (diff) | |
download | gpgme-0cb625da84d7e5deeacad113c404a8bc2154c8e7.tar.gz gpgme-0cb625da84d7e5deeacad113c404a8bc2154c8e7.zip |
python examples: another importer
* Fixed a similar type of bug with the non-protonmail importer.
Diffstat (limited to 'lang/python/examples/howto/import-keys-hkp.py')
-rwxr-xr-x | lang/python/examples/howto/import-keys-hkp.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lang/python/examples/howto/import-keys-hkp.py b/lang/python/examples/howto/import-keys-hkp.py index 7d873ca4..e6195241 100755 --- a/lang/python/examples/howto/import-keys-hkp.py +++ b/lang/python/examples/howto/import-keys-hkp.py @@ -45,7 +45,10 @@ else: try: 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: keys = [] for logrus in pattern.split(): @@ -56,9 +59,10 @@ except Exception as e: keys.append(key[0]) print("Found {0} key(s).".format(len(keys))) -for key in keys: - import_result = c.key_import(key.key_blob) - results.append(import_result) +if keys is not None: + for key in keys: + import_result = c.key_import(key.key_blob) + results.append(import_result) for result in results: if result is not None and hasattr(result, "considered") is False: |