## Python: Importing libsecret

In python use the standard introspection import mechanism to get at libsecret:

    1
    2
    3
    4
    5
    from gi.repository import Secret

    # ... and a here's sample line of code which uses the import
    schema = Secret.Schema.new("org.mock.Schema",
        Secret.SchemaFlags.NONE, { "name", Secret.SchemaAttributeType.STRING })

Some parts of the libsecret API are not yet stable. It is not recommended that you use these unstable parts from python. Your code will break when the unstable API changes, and due to the lack of a compiler you will have no way of knowing when it does. If you must use the unstable API, you would do it like this:

    1
    2
    3
    4
    5
    # Warning: if you use the unstable API from python, your're going to have a bad time
    from gi.repository import SecretUnstable

    # ... and a here's sample line of code which uses the import
    collection = SecretUnstable.Collection.for_alias(None, "default", None);