From 0e762608ef5a598030b8d0e56261a830e1b7b724 Mon Sep 17 00:00:00 2001 From: Ben McGinnes Date: Sun, 17 Jun 2018 09:28:30 +1000 Subject: python bindings: core key import * The foundation of a pythonic key import function authored by Jacob Adams. * A unit testing script for the same function originally authored by Tobias Mueller * Added DCO reference for Jacob Adams to the GPGME AUTHORS file. * Additional details regarding this patch are available here: https://dev.gnupg.org/T4001 Signed-off-by: Ben McGinnes --- lang/python/src/core.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'lang/python/src') diff --git a/lang/python/src/core.py b/lang/python/src/core.py index bd95d231..1b83a5d4 100644 --- a/lang/python/src/core.py +++ b/lang/python/src/core.py @@ -509,6 +509,25 @@ class Context(GpgmeWrapper): return results + def key_import(self, data): + """Import data + + Imports the given data into the Context. + + Returns: + result -- information about the imported data + + Raises: + GPGMEError -- as signaled by the underlying library + ValueError -- Raised if no keys are present in the data + + """ + self.op_import(data) + result = self.op_import_result() + if result.considered == 0: + raise ValueError + return result + def keylist(self, pattern=None, secret=False, mode=constants.keylist.mode.LOCAL, source=None): -- cgit v1.2.3