diff options
| author | Daniel Kahn Gillmor <[email protected]> | 2016-10-28 20:45:49 +0000 | 
|---|---|---|
| committer | Justus Winter <[email protected]> | 2016-10-31 14:42:27 +0000 | 
| commit | 2fac017618a76882605125b05ff1f7393fe99860 (patch) | |
| tree | b7eddc17682b6aa91b8c3c723a2fc02f28ac0a6c /lang/python/examples | |
| parent | core: New API functions gpgme_set_sender, gpgme_get_sender. (diff) | |
| download | gpgme-2fac017618a76882605125b05ff1f7393fe99860.tar.gz gpgme-2fac017618a76882605125b05ff1f7393fe99860.zip | |
python: Rename Python module from PyME to gpg.
This follows weeks of discussion on the gnupg-devel mailing list.
Hopefully it will make it easier for people using Python to use GnuPG
in the future.
Signed-off-by: Daniel Kahn Gillmor <[email protected]>
Diffstat (limited to 'lang/python/examples')
| -rw-r--r-- | lang/python/examples/assuan.py | 4 | ||||
| -rw-r--r-- | lang/python/examples/decryption-filter.py | 6 | ||||
| -rwxr-xr-x | lang/python/examples/delkey.py | 6 | ||||
| -rwxr-xr-x | lang/python/examples/encrypt-to-all.py | 6 | ||||
| -rwxr-xr-x | lang/python/examples/exportimport.py | 12 | ||||
| -rwxr-xr-x | lang/python/examples/genkey.py | 8 | ||||
| -rw-r--r-- | lang/python/examples/inter-edit.py | 4 | ||||
| -rwxr-xr-x | lang/python/examples/sign.py | 6 | ||||
| -rwxr-xr-x | lang/python/examples/signverify.py | 10 | ||||
| -rwxr-xr-x | lang/python/examples/simple.py | 4 | ||||
| -rw-r--r-- | lang/python/examples/testCMSgetkey.py | 4 | ||||
| -rwxr-xr-x | lang/python/examples/verifydetails.py | 4 | 
12 files changed, 37 insertions, 37 deletions
| diff --git a/lang/python/examples/assuan.py b/lang/python/examples/assuan.py index 22960d31..f02cd166 100644 --- a/lang/python/examples/assuan.py +++ b/lang/python/examples/assuan.py @@ -20,9 +20,9 @@  from __future__ import absolute_import, print_function, unicode_literals  del absolute_import, print_function, unicode_literals -import pyme +import gpg -with pyme.Context(protocol=pyme.constants.PROTOCOL_ASSUAN) as c: +with gpg.Context(protocol=gpg.constants.PROTOCOL_ASSUAN) as c:      # Invoke the pinentry to get a confirmation.      err = c.assuan_transact(['GET_CONFIRMATION', 'Hello there'])      print("You chose {}.".format("cancel" if err else "ok")) diff --git a/lang/python/examples/decryption-filter.py b/lang/python/examples/decryption-filter.py index 3007c2b0..987dfd13 100644 --- a/lang/python/examples/decryption-filter.py +++ b/lang/python/examples/decryption-filter.py @@ -17,7 +17,7 @@  """A decryption filter -This demonstrates decryption using pyme3 in three lines of code.  To +This demonstrates decryption using gpg3 in three lines of code.  To  be used like this:  ./decryption-filter.py <message.gpg >message.plain @@ -28,5 +28,5 @@ from __future__ import absolute_import, print_function, unicode_literals  del absolute_import, print_function, unicode_literals  import sys -import pyme -pyme.Context().decrypt(sys.stdin, sink=sys.stdout) +import gpg +gpg.Context().decrypt(sys.stdin, sink=sys.stdout) diff --git a/lang/python/examples/delkey.py b/lang/python/examples/delkey.py index a02f4129..12510f3e 100755 --- a/lang/python/examples/delkey.py +++ b/lang/python/examples/delkey.py @@ -22,12 +22,12 @@  from __future__ import absolute_import, print_function, unicode_literals  del absolute_import, print_function, unicode_literals -import pyme +import gpg -with pyme.Context() as c: +with gpg.Context() as c:      # Note: We must not modify the key store during iteration,      # therefore, we explicitly make a list. -    keys = list(c.keylist("[email protected]")) +    keys = list(c.keylist("[email protected]"))      for k in keys:          c.op_delete(k, True) diff --git a/lang/python/examples/encrypt-to-all.py b/lang/python/examples/encrypt-to-all.py index 35873bde..bad4220c 100755 --- a/lang/python/examples/encrypt-to-all.py +++ b/lang/python/examples/encrypt-to-all.py @@ -26,9 +26,9 @@ from __future__ import absolute_import, print_function, unicode_literals  del absolute_import, print_function, unicode_literals  import sys -import pyme +import gpg -with pyme.Context(armor=True) as c: +with gpg.Context(armor=True) as c:      recipients = list()      for key in c.keylist():          valid = 0 @@ -42,7 +42,7 @@ with pyme.Context(armor=True) as c:          try:              ciphertext, _, _ = c.encrypt(b'This is my message.',                                           recipients=recipients) -        except pyme.errors.InvalidRecipients as e: +        except gpg.errors.InvalidRecipients as e:              print("Encryption failed for these keys:\n{0!s}".format(e))              # filter out the bad keys diff --git a/lang/python/examples/exportimport.py b/lang/python/examples/exportimport.py index bc946bc4..8ae87a8c 100755 --- a/lang/python/examples/exportimport.py +++ b/lang/python/examples/exportimport.py @@ -17,18 +17,18 @@  # along with this program; if not, see <http://www.gnu.org/licenses/>.  # Sample of export and import of keys -# It uses keys for [email protected] generated by genkey.py script +# It uses keys for [email protected] generated by genkey.py script  from __future__ import absolute_import, print_function, unicode_literals  del absolute_import, print_function, unicode_literals  import sys  import os -import pyme +import gpg -user = "[email protected]" +user = "[email protected]" -with pyme.Context(armor=True) as c, pyme.Data() as expkey: +with gpg.Context(armor=True) as c, gpg.Data() as expkey:      print(" - Export %s's public keys - " % user)      c.op_export(user, 0, expkey) @@ -43,7 +43,7 @@ with pyme.Context(armor=True) as c, pyme.Data() as expkey:  # delete keys to ensure that they came from our imported data.  Note  # that if joe's key has private part as well we can only delete both  # of them. -with pyme.Context() as c: +with gpg.Context() as c:      # Note: We must not modify the key store during iteration,      # therfore, we explicitly make a list.      keys = list(c.keylist(user)) @@ -51,7 +51,7 @@ with pyme.Context() as c:      for k in keys:          c.op_delete(k, True) -with pyme.Context() as c: +with gpg.Context() as c:      print(" - Import exported keys - ")      c.op_import(expstring)      result = c.op_import_result() diff --git a/lang/python/examples/genkey.py b/lang/python/examples/genkey.py index ee70303d..a043500e 100755 --- a/lang/python/examples/genkey.py +++ b/lang/python/examples/genkey.py @@ -20,7 +20,7 @@  from __future__ import absolute_import, print_function, unicode_literals  del absolute_import, print_function, unicode_literals -import pyme +import gpg  # This is the example from the GPGME manual. @@ -31,14 +31,14 @@ Subkey-Type: RSA  Subkey-Length: 2048  Name-Real: Joe Tester  Name-Comment: with stupid passphrase -Name-Email: [email protected] +Name-Email: [email protected]  Passphrase: Crypt0R0cks  Expire-Date: 2020-12-31  </GnupgKeyParms>  """ -with pyme.Context() as c: -    c.set_progress_cb(pyme.callbacks.progress_stdout) +with gpg.Context() as c: +    c.set_progress_cb(gpg.callbacks.progress_stdout)      c.op_genkey(parms, None, None)      print("Generated key with fingerprint {0}.".format(          c.op_genkey_result().fpr)) diff --git a/lang/python/examples/inter-edit.py b/lang/python/examples/inter-edit.py index 3c0f29ba..ed0d8c42 100644 --- a/lang/python/examples/inter-edit.py +++ b/lang/python/examples/inter-edit.py @@ -22,14 +22,14 @@ from __future__ import absolute_import, print_function, unicode_literals  del absolute_import, print_function, unicode_literals  import sys -import pyme +import gpg  if len(sys.argv) != 2:      sys.exit("Usage: %s <Gpg key pattern>\n" % sys.argv[0])  name = sys.argv[1] -with pyme.Context() as c: +with gpg.Context() as c:      keys = list(c.keylist(name))      if len(keys) == 0:          sys.exit("No key matching {}.".format(name)) diff --git a/lang/python/examples/sign.py b/lang/python/examples/sign.py index 2f235baf..16c2256a 100755 --- a/lang/python/examples/sign.py +++ b/lang/python/examples/sign.py @@ -20,9 +20,9 @@ from __future__ import absolute_import, print_function, unicode_literals  del absolute_import, print_function, unicode_literals  import sys -import pyme -from pyme.constants.sig import mode +import gpg +from gpg.constants.sig import mode -with pyme.Context() as c: +with gpg.Context() as c:      signed, _ = c.sign(b"Test message", mode=mode.CLEAR)      sys.stdout.buffer.write(signed) diff --git a/lang/python/examples/signverify.py b/lang/python/examples/signverify.py index 03bc0a64..5870ca95 100755 --- a/lang/python/examples/signverify.py +++ b/lang/python/examples/signverify.py @@ -17,18 +17,18 @@  # along with this program; if not, see <http://www.gnu.org/licenses/>.  # Sample of unattended signing/verifying of a message. -# It uses keys for [email protected] generated by genkey.py script +# It uses keys for [email protected] generated by genkey.py script  from __future__ import absolute_import, print_function, unicode_literals  del absolute_import, print_function, unicode_literals  import sys -import pyme -from pyme.constants.sig import mode +import gpg +from gpg.constants.sig import mode -user = "joe+pyme" +user = "joe+gpg" -with pyme.Context(pinentry_mode=pyme.constants.PINENTRY_MODE_LOOPBACK) as c: +with gpg.Context(pinentry_mode=gpg.constants.PINENTRY_MODE_LOOPBACK) as c:      keys = list(c.keylist(user))      if len(keys) == 0:          sys.exit("No key matching {}.".format(user)) diff --git a/lang/python/examples/simple.py b/lang/python/examples/simple.py index 5598487b..8f451d7c 100755 --- a/lang/python/examples/simple.py +++ b/lang/python/examples/simple.py @@ -21,9 +21,9 @@ from __future__ import absolute_import, print_function, unicode_literals  del absolute_import, print_function, unicode_literals  import sys -import pyme +import gpg -with pyme.Context(armor=True) as c: +with gpg.Context(armor=True) as c:      recipients = []      print("Enter name of your recipient(s), end with a blank line.")      while True: diff --git a/lang/python/examples/testCMSgetkey.py b/lang/python/examples/testCMSgetkey.py index 62c35d26..0f02cb1b 100644 --- a/lang/python/examples/testCMSgetkey.py +++ b/lang/python/examples/testCMSgetkey.py @@ -22,12 +22,12 @@ from __future__ import absolute_import, print_function, unicode_literals  del absolute_import, print_function, unicode_literals  import sys -import pyme +import gpg  if len(sys.argv) != 2:      sys.exit("fingerprint or unique key ID for gpgme_get_key()") -with pyme.Context(protocol=pyme.constants.PROTOCOL_CMS) as c: +with gpg.Context(protocol=gpg.constants.PROTOCOL_CMS) as c:      key = c.get_key(sys.argv[1])      print("got key: ", key.subkeys[0].fpr) diff --git a/lang/python/examples/verifydetails.py b/lang/python/examples/verifydetails.py index 81f82e99..0d2b72cb 100755 --- a/lang/python/examples/verifydetails.py +++ b/lang/python/examples/verifydetails.py @@ -21,8 +21,8 @@ from __future__ import absolute_import, print_function, unicode_literals  del absolute_import, print_function, unicode_literals  import sys -from pyme import core -from pyme.constants import protocol +from gpg import core +from gpg.constants import protocol  def print_engine_infos():      print("gpgme version:", core.check_version(None)) | 
