diff options
author | Arvin Schnell <aschnell@suse.de> | 2007-08-30 14:43:29 +0000 |
---|---|---|
committer | Arvin Schnell <aschnell@suse.de> | 2007-08-30 14:43:29 +0000 |
commit | 8f6f0c3a063b8b41a753af6cce6a8942da5ba49d (patch) | |
tree | 3e8734dd633fc10877381e17fff972177fd796b8 /examples | |
parent | 41e79be72fcd029d9de8fa7f62671084f13e6db9 (diff) | |
download | libzypp-bindings-8f6f0c3a063b8b41a753af6cce6a8942da5ba49d.tar.gz libzypp-bindings-8f6f0c3a063b8b41a753af6cce6a8942da5ba49d.tar.bz2 libzypp-bindings-8f6f0c3a063b8b41a753af6cce6a8942da5ba49d.zip |
- some work on python bindings
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/python/keyring.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/examples/python/keyring.py b/examples/python/keyring.py new file mode 100755 index 0000000..7758aa1 --- /dev/null +++ b/examples/python/keyring.py @@ -0,0 +1,29 @@ +#!/usr/bin/python + +from zypp import ZYppFactory, Pathname, KeyRing, PublicKey + + +keyring = ZYppFactory.instance().getZYpp().keyRing() + +path = Pathname("/suse/aschnell/tmp/repodata/repomd.xml.key") +print path + +publickey = PublicKey(path) +print publickey + +id = publickey.id() + +print "is key known/trusted %s %s" % (keyring.isKeyKnown(id), keyring.isKeyTrusted(id)) + +keyring.importKey(publickey, True) + +print "is key known/trusted %s %s" % (keyring.isKeyKnown(id), keyring.isKeyTrusted(id)) + +print "list of known keys:" +for key in keyring.publicKeys(): + print key + +print "list of trusted keys:" +for key in keyring.trustedPublicKeys(): + print key + |