diff --git a/doc/gpgme-python-howto.texi b/doc/gpgme-python-howto.texi index 2863d57d..7b8b79d1 100644 --- a/doc/gpgme-python-howto.texi +++ b/doc/gpgme-python-howto.texi @@ -843,12 +843,19 @@ importing of the keys found. @example import gpg import hkp4py +import sys c = gpg.Context() -server = hkp4py.KeyServer("https://hkps.pool.sks-keyservers.net") -pattern = input("Enter the pattern to search for keys or user IDs: ") +server = hkp4py.KeyServer("hkps://hkps.pool.sks-keyservers.net") results = [] +if len(sys.argv) > 2: + pattern = " ".join(sys.argv[1:]) +elif len(sys.argv) == 2: + pattern = sys.argv[1] +else: + pattern = input("Enter the pattern to search for keys or user IDs: ") + try: keys = server.search(pattern) print("Found @{0@} key(s).".format(len(keys))) @@ -2377,6 +2384,11 @@ Without that recent addition it would have been necessary to encode the contents of each @samp{hkp4py.KeyServer().search()[i].key} in @samp{hkp4py.KeyServer().search()} before trying to import it. +An example of this is included in the @ref{Importing keys, , Importing Keys} section of this +HOWTO and the corresponding executable version of that example is +available in the @samp{lang/python/examples/howto} directory as normal; the +executable version is the @samp{import-keys-hkp.py} file. + @node Copyright and Licensing @chapter Copyright and Licensing diff --git a/lang/python/docs/gpgme-python-howto.org b/lang/python/docs/gpgme-python-howto.org index 58964f35..b5b9ed4c 100644 --- a/lang/python/docs/gpgme-python-howto.org +++ b/lang/python/docs/gpgme-python-howto.org @@ -2288,6 +2288,10 @@ Without that recent addition it would have been necessary to encode the contents of each =hkp4py.KeyServer().search()[i].key= in =hkp4py.KeyServer().search()= before trying to import it. +An example of this is included in the [[#howto-import-key][Importing Keys]] section of this +HOWTO and the corresponding executable version of that example is +available in the =lang/python/examples/howto= directory as normal; the +executable version is the =import-keys-hkp.py= file. * Copyright and Licensing diff --git a/lang/python/examples/howto/add-userid.py b/lang/python/examples/howto/add-userid.py index b8689792..0c7bb893 100755 --- a/lang/python/examples/howto/add-userid.py +++ b/lang/python/examples/howto/add-userid.py @@ -18,7 +18,7 @@ from __future__ import absolute_import, division, unicode_literals # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU -# Lesser General Public Licensefor more details. +# Lesser General Public License for more details. # # You should have received a copy of the GNU General Public License and the GNU # Lesser General Public along with this program; if not, see diff --git a/lang/python/examples/howto/clear-sign-file.py b/lang/python/examples/howto/clear-sign-file.py index 597bbc59..9d350e25 100755 --- a/lang/python/examples/howto/clear-sign-file.py +++ b/lang/python/examples/howto/clear-sign-file.py @@ -18,7 +18,7 @@ from __future__ import absolute_import, division, unicode_literals # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU -# Lesser General Public Licensefor more details. +# Lesser General Public License for more details. # # You should have received a copy of the GNU General Public License and the GNU # Lesser General Public along with this program; if not, see diff --git a/lang/python/examples/howto/create-key.py b/lang/python/examples/howto/create-key.py index 429ab1f7..02d1cb30 100755 --- a/lang/python/examples/howto/create-key.py +++ b/lang/python/examples/howto/create-key.py @@ -18,7 +18,7 @@ from __future__ import absolute_import, division, unicode_literals # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU -# Lesser General Public Licensefor more details. +# Lesser General Public License for more details. # # You should have received a copy of the GNU General Public License and the GNU # Lesser General Public along with this program; if not, see diff --git a/lang/python/examples/howto/decrypt-file.py b/lang/python/examples/howto/decrypt-file.py index 2fe37f27..8eba1f25 100755 --- a/lang/python/examples/howto/decrypt-file.py +++ b/lang/python/examples/howto/decrypt-file.py @@ -18,7 +18,7 @@ from __future__ import absolute_import, division, unicode_literals # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU -# Lesser General Public Licensefor more details. +# Lesser General Public License for more details. # # You should have received a copy of the GNU General Public License and the GNU # Lesser General Public along with this program; if not, see diff --git a/lang/python/examples/howto/detach-sign-file.py b/lang/python/examples/howto/detach-sign-file.py index 99fbe65e..a0c5a2ad 100755 --- a/lang/python/examples/howto/detach-sign-file.py +++ b/lang/python/examples/howto/detach-sign-file.py @@ -18,7 +18,7 @@ from __future__ import absolute_import, division, unicode_literals # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU -# Lesser General Public Licensefor more details. +# Lesser General Public License for more details. # # You should have received a copy of the GNU General Public License and the GNU # Lesser General Public along with this program; if not, see diff --git a/lang/python/examples/howto/encrypt-file.py b/lang/python/examples/howto/encrypt-file.py index 7c84a6f9..8951cb5c 100755 --- a/lang/python/examples/howto/encrypt-file.py +++ b/lang/python/examples/howto/encrypt-file.py @@ -21,7 +21,7 @@ import sys # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU -# Lesser General Public Licensefor more details. +# Lesser General Public License for more details. # # You should have received a copy of the GNU General Public License and the GNU # Lesser General Public along with this program; if not, see diff --git a/lang/python/examples/howto/encrypt-sign-file.py b/lang/python/examples/howto/encrypt-sign-file.py index a08176b7..6610ee05 100755 --- a/lang/python/examples/howto/encrypt-sign-file.py +++ b/lang/python/examples/howto/encrypt-sign-file.py @@ -21,7 +21,7 @@ import sys # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU -# Lesser General Public Licensefor more details. +# Lesser General Public License for more details. # # You should have received a copy of the GNU General Public License and the GNU # Lesser General Public along with this program; if not, see diff --git a/lang/python/examples/howto/encrypt-to-group-gullible.py b/lang/python/examples/howto/encrypt-to-group-gullible.py index c96e8294..5ba82bcb 100755 --- a/lang/python/examples/howto/encrypt-to-group-gullible.py +++ b/lang/python/examples/howto/encrypt-to-group-gullible.py @@ -22,7 +22,7 @@ from groups import group_lists # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU -# Lesser General Public Licensefor more details. +# Lesser General Public License for more details. # # You should have received a copy of the GNU General Public License and the GNU # Lesser General Public along with this program; if not, see diff --git a/lang/python/examples/howto/encrypt-to-group-trustno1.py b/lang/python/examples/howto/encrypt-to-group-trustno1.py index da0376b5..680c9eab 100755 --- a/lang/python/examples/howto/encrypt-to-group-trustno1.py +++ b/lang/python/examples/howto/encrypt-to-group-trustno1.py @@ -22,7 +22,7 @@ from groups import group_lists # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU -# Lesser General Public Licensefor more details. +# Lesser General Public License for more details. # # You should have received a copy of the GNU General Public License and the GNU # Lesser General Public along with this program; if not, see diff --git a/lang/python/examples/howto/encrypt-to-group.py b/lang/python/examples/howto/encrypt-to-group.py index d4cb0745..e4ef1b6c 100755 --- a/lang/python/examples/howto/encrypt-to-group.py +++ b/lang/python/examples/howto/encrypt-to-group.py @@ -22,7 +22,7 @@ from groups import group_lists # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU -# Lesser General Public Licensefor more details. +# Lesser General Public License for more details. # # You should have received a copy of the GNU General Public License and the GNU # Lesser General Public along with this program; if not, see diff --git a/lang/python/examples/howto/export-key.py b/lang/python/examples/howto/export-key.py index 913bfce7..80768fe7 100755 --- a/lang/python/examples/howto/export-key.py +++ b/lang/python/examples/howto/export-key.py @@ -22,7 +22,7 @@ import sys # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU -# Lesser General Public Licensefor more details. +# Lesser General Public License for more details. # # You should have received a copy of the GNU General Public License and the GNU # Lesser General Public along with this program; if not, see diff --git a/lang/python/examples/howto/export-minimised-key.py b/lang/python/examples/howto/export-minimised-key.py index 3889adcd..9d5f8488 100755 --- a/lang/python/examples/howto/export-minimised-key.py +++ b/lang/python/examples/howto/export-minimised-key.py @@ -22,7 +22,7 @@ import sys # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU -# Lesser General Public Licensefor more details. +# Lesser General Public License for more details. # # You should have received a copy of the GNU General Public License and the GNU # Lesser General Public along with this program; if not, see diff --git a/lang/python/examples/howto/export-secret-key.py b/lang/python/examples/howto/export-secret-key.py index e9c53fe5..ccc9f45d 100755 --- a/lang/python/examples/howto/export-secret-key.py +++ b/lang/python/examples/howto/export-secret-key.py @@ -23,7 +23,7 @@ import sys # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU -# Lesser General Public Licensefor more details. +# Lesser General Public License for more details. # # You should have received a copy of the GNU General Public License and the GNU # Lesser General Public along with this program; if not, see diff --git a/lang/python/examples/howto/export-secret-keys.py b/lang/python/examples/howto/export-secret-keys.py index 0f4d8ee4..f2f1ccde 100755 --- a/lang/python/examples/howto/export-secret-keys.py +++ b/lang/python/examples/howto/export-secret-keys.py @@ -24,7 +24,7 @@ import sys # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU -# Lesser General Public Licensefor more details. +# Lesser General Public License for more details. # # You should have received a copy of the GNU General Public License and the GNU # Lesser General Public along with this program; if not, see diff --git a/lang/python/examples/howto/groups.py b/lang/python/examples/howto/groups.py index 72135382..3d51b255 100644 --- a/lang/python/examples/howto/groups.py +++ b/lang/python/examples/howto/groups.py @@ -17,7 +17,7 @@ from __future__ import absolute_import, division, unicode_literals # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU -# Lesser General Public Licensefor more details. +# Lesser General Public License for more details. # # You should have received a copy of the GNU General Public License and the GNU # Lesser General Public along with this program; if not, see diff --git a/lang/python/examples/howto/import-key.py b/lang/python/examples/howto/import-key.py index 25913785..ab52ba21 100755 --- a/lang/python/examples/howto/import-key.py +++ b/lang/python/examples/howto/import-key.py @@ -24,7 +24,7 @@ del absolute_import, division, unicode_literals # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU -# Lesser General Public Licensefor more details. +# Lesser General Public License for more details. # # You should have received a copy of the GNU General Public License and the GNU # Lesser General Public along with this program; if not, see diff --git a/lang/python/examples/howto/import-keys.py b/lang/python/examples/howto/import-keys.py index bdc15a68..d1a268ef 100755 --- a/lang/python/examples/howto/import-keys.py +++ b/lang/python/examples/howto/import-keys.py @@ -22,7 +22,7 @@ import requests # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU -# Lesser General Public Licensefor more details. +# Lesser General Public License for more details. # # You should have received a copy of the GNU General Public License and the GNU # Lesser General Public along with this program; if not, see diff --git a/lang/python/examples/howto/keycount.py b/lang/python/examples/howto/keycount.py index 8e25454c..af472723 100755 --- a/lang/python/examples/howto/keycount.py +++ b/lang/python/examples/howto/keycount.py @@ -18,7 +18,7 @@ from __future__ import absolute_import, division, unicode_literals # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU -# Lesser General Public Licensefor more details. +# Lesser General Public License for more details. # # You should have received a copy of the GNU General Public License and the GNU # Lesser General Public along with this program; if not, see diff --git a/lang/python/examples/howto/mutt-groups.py b/lang/python/examples/howto/mutt-groups.py index c0b515a7..6572a217 100755 --- a/lang/python/examples/howto/mutt-groups.py +++ b/lang/python/examples/howto/mutt-groups.py @@ -18,7 +18,7 @@ from __future__ import absolute_import, division, unicode_literals # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU -# Lesser General Public Licensefor more details. +# Lesser General Public License for more details. # # You should have received a copy of the GNU General Public License and the GNU # Lesser General Public along with this program; if not, see diff --git a/lang/python/examples/howto/pmkey-import-alt.py b/lang/python/examples/howto/pmkey-import-alt.py index 1b260e17..c7822f35 100755 --- a/lang/python/examples/howto/pmkey-import-alt.py +++ b/lang/python/examples/howto/pmkey-import-alt.py @@ -25,7 +25,7 @@ del absolute_import, division, unicode_literals # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU -# Lesser General Public Licensefor more details. +# Lesser General Public License for more details. # # You should have received a copy of the GNU General Public License and the GNU # Lesser General Public along with this program; if not, see diff --git a/lang/python/examples/howto/pmkey-import.py b/lang/python/examples/howto/pmkey-import.py index 66ad8aa9..58a01c8a 100755 --- a/lang/python/examples/howto/pmkey-import.py +++ b/lang/python/examples/howto/pmkey-import.py @@ -24,7 +24,7 @@ del absolute_import, division, unicode_literals # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU -# Lesser General Public Licensefor more details. +# Lesser General Public License for more details. # # You should have received a copy of the GNU General Public License and the GNU # Lesser General Public along with this program; if not, see diff --git a/lang/python/examples/howto/revoke-userid.py b/lang/python/examples/howto/revoke-userid.py index 7a3d190b..be347480 100755 --- a/lang/python/examples/howto/revoke-userid.py +++ b/lang/python/examples/howto/revoke-userid.py @@ -18,7 +18,7 @@ from __future__ import absolute_import, division, unicode_literals # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU -# Lesser General Public Licensefor more details. +# Lesser General Public License for more details. # # You should have received a copy of the GNU General Public License and the GNU # Lesser General Public along with this program; if not, see diff --git a/lang/python/examples/howto/sign-file.py b/lang/python/examples/howto/sign-file.py index 01006df0..f6809650 100755 --- a/lang/python/examples/howto/sign-file.py +++ b/lang/python/examples/howto/sign-file.py @@ -18,7 +18,7 @@ from __future__ import absolute_import, division, unicode_literals # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU -# Lesser General Public Licensefor more details. +# Lesser General Public License for more details. # # You should have received a copy of the GNU General Public License and the GNU # Lesser General Public along with this program; if not, see diff --git a/lang/python/examples/howto/sign-key.py b/lang/python/examples/howto/sign-key.py index b1afe13c..6d32c57d 100755 --- a/lang/python/examples/howto/sign-key.py +++ b/lang/python/examples/howto/sign-key.py @@ -18,7 +18,7 @@ from __future__ import absolute_import, division, unicode_literals # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU -# Lesser General Public Licensefor more details. +# Lesser General Public License for more details. # # You should have received a copy of the GNU General Public License and the GNU # Lesser General Public along with this program; if not, see diff --git a/lang/python/examples/howto/symcrypt-file.py b/lang/python/examples/howto/symcrypt-file.py index 785a4d04..bce92861 100755 --- a/lang/python/examples/howto/symcrypt-file.py +++ b/lang/python/examples/howto/symcrypt-file.py @@ -21,7 +21,7 @@ import sys # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU -# Lesser General Public Licensefor more details. +# Lesser General Public License for more details. # # You should have received a copy of the GNU General Public License and the GNU # Lesser General Public along with this program; if not, see diff --git a/lang/python/examples/howto/temp-homedir-config.py b/lang/python/examples/howto/temp-homedir-config.py index 1111fe21..98bde367 100755 --- a/lang/python/examples/howto/temp-homedir-config.py +++ b/lang/python/examples/howto/temp-homedir-config.py @@ -22,7 +22,7 @@ import sys # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU -# Lesser General Public Licensefor more details. +# Lesser General Public License for more details. # # You should have received a copy of the GNU General Public License and the GNU # Lesser General Public along with this program; if not, see diff --git a/lang/python/examples/howto/verify-signatures.py b/lang/python/examples/howto/verify-signatures.py index 8aafc3ba..aa4331c2 100755 --- a/lang/python/examples/howto/verify-signatures.py +++ b/lang/python/examples/howto/verify-signatures.py @@ -18,7 +18,7 @@ from __future__ import absolute_import, division, unicode_literals # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU -# Lesser General Public Licensefor more details. +# Lesser General Public License for more details. # # You should have received a copy of the GNU General Public License and the GNU # Lesser General Public along with this program; if not, see diff --git a/lang/python/examples/howto/verify-signed-file.py b/lang/python/examples/howto/verify-signed-file.py index 9f8702f5..c561fe80 100755 --- a/lang/python/examples/howto/verify-signed-file.py +++ b/lang/python/examples/howto/verify-signed-file.py @@ -18,7 +18,7 @@ from __future__ import absolute_import, division, unicode_literals # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU -# Lesser General Public Licensefor more details. +# Lesser General Public License for more details. # # You should have received a copy of the GNU General Public License and the GNU # Lesser General Public along with this program; if not, see