From cacca62d06c6cf4a291f7ab2571cf52d671d140f Mon Sep 17 00:00:00 2001 From: Ben McGinnes Date: Sun, 8 Jul 2018 03:40:35 +1000 Subject: python bindings: howto examples * Made sure all example scripts meet PEP8 compliance. * Required fixing approx. a dozen of them in minor ways. --- lang/python/examples/howto/import-keys.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'lang/python/examples/howto/import-keys.py') diff --git a/lang/python/examples/howto/import-keys.py b/lang/python/examples/howto/import-keys.py index 8a3bb29d..bdc15a68 100755 --- a/lang/python/examples/howto/import-keys.py +++ b/lang/python/examples/howto/import-keys.py @@ -3,6 +3,10 @@ from __future__ import absolute_import, division, unicode_literals +import gpg +import os.path +import requests + # Copyright (C) 2018 Ben McGinnes # # This program is free software; you can redistribute it and/or modify it under @@ -24,21 +28,14 @@ from __future__ import absolute_import, division, unicode_literals # Lesser General Public along with this program; if not, see # . -import gpg -import os.path -import requests - print(""" This script imports one or more public keys from the SKS keyservers. """) -import gpg -import requests - c = gpg.Context() url = "https://sks-keyservers.net/pks/lookup" pattern = input("Enter the pattern to search for key or user IDs: ") -payload = { "op": "get", "search": pattern } +payload = {"op": "get", "search": pattern} r = requests.get(url, verify=True, params=payload) result = c.key_import(r.content) -- cgit v1.2.3