diff options
author | Ben McGinnes <[email protected]> | 2018-09-23 01:43:34 +0000 |
---|---|---|
committer | Ben McGinnes <[email protected]> | 2018-09-23 01:43:34 +0000 |
commit | ced4bdbbb239c1fe209665b4f5a7aeb9651889ed (patch) | |
tree | 104689f6b72603372e82589fc45c0eca287df68b /doc | |
parent | python bindings: importing from keyservers with hkp4py (diff) | |
download | gpgme-ced4bdbbb239c1fe209665b4f5a7aeb9651889ed.tar.gz gpgme-ced4bdbbb239c1fe209665b4f5a7aeb9651889ed.zip |
examples: python bindings and hkp4py updates
* Mostly tightening up the details on the hkp4py example script.
* Also fixed a typo in the LGPL boiler plate text included in all the
other example scripts for the HOWTO.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/gpgme-python-howto.texi | 16 |
1 files changed, 14 insertions, 2 deletions
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 |