aboutsummaryrefslogtreecommitdiffstats
path: root/lang/python/src/core.py
diff options
context:
space:
mode:
Diffstat (limited to 'lang/python/src/core.py')
-rw-r--r--lang/python/src/core.py19
1 files changed, 19 insertions, 0 deletions
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):