# secretstorage - pydoc - phpman

Help on package secretstorage:

## NAME
    secretstorage

## DESCRIPTION
    This file provides quick access to all SecretStorage API. Please
    refer to documentation of individual modules for API details.

## PACKAGE CONTENTS
    collection
    defines
    dhcrypto
    exceptions
    item
    util

## CLASSES
    builtins.Exception(builtins.BaseException)
        secretstorage.exceptions.SecretStorageException
            secretstorage.exceptions.ItemNotFoundException
                secretstorage.exceptions.PromptDismissedException
            secretstorage.exceptions.LockedException
            secretstorage.exceptions.SecretServiceNotAvailableException
    builtins.object
        secretstorage.collection.Collection
        secretstorage.item.Item

### class Collection
     |  Collection(connection: jeepney.io.blocking.DBusConnection, collection_path: str = '/org/freedesktop/secrets/aliases/default', session: Optional[secretstorage.dhcrypto.Session] = None) -> None
     |
     |  Represents a collection.
     |
     |  Methods defined here:
     |
     |  __init__(self, connection: jeepney.io.blocking.DBusConnection, collection_path: str = '/org/freedesktop/secrets/aliases/default', session: Optional[secretstorage.dhcrypto.Session] = None) -> None
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  create_item(self, label: str, attributes: Dict[str, str], secret: bytes, replace: bool = False, content_type: str = 'text/plain') -> secretstorage.item.Item
     |      Creates a new :class:`~secretstorage.item.Item` with given
     |      `label` (unicode string), `attributes` (dictionary) and `secret`
     |      (bytestring). If `replace` is :const:`True`, replaces the existing
     |      item with the same attributes. If `content_type` is given, also
     |      sets the content type of the secret (``text/plain`` by default).
     |      Returns the created item.
     |
     |  delete(self) -> None
     |      Deletes the collection and all items inside it.
     |
     |  ensure_not_locked(self) -> None
     |      If collection is locked, raises
     |      :exc:`~secretstorage.exceptions.LockedException`.
     |
     |  get_all_items(self) -> Iterator[secretstorage.item.Item]
     |      Returns a generator of all items in the collection.
     |
     |  get_label(self) -> str
     |      Returns the collection label.
     |
     |  is_locked(self) -> bool
     |      Returns :const:`True` if item is locked, otherwise
     |      :const:`False`.
     |
     |  lock(self) -> None
     |      Locks the collection.
     |
     |  search_items(self, attributes: Dict[str, str]) -> Iterator[secretstorage.item.Item]
     |      Returns a generator of items with the given attributes.
     |      `attributes` should be a dictionary.
     |
     |  set_label(self, label: str) -> None
     |      Sets collection label to `label`.
     |
     |  unlock(self) -> bool
     |      Requests unlocking the collection.
     |
     |      Returns a boolean representing whether the prompt has been
     |      dismissed; that means :const:`False` on successful unlocking
     |      and :const:`True` if it has been dismissed.
     |
     |      .. versionchanged:: 3.0
     |         No longer accepts the ``callback`` argument.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)

### class Item
     |  Item(connection: jeepney.io.blocking.DBusConnection, item_path: str, session: Optional[secretstorage.dhcrypto.Session] = None) -> None
     |
     |  Represents a secret item.
     |
     |  Methods defined here:
     |
     |  __eq__(self, other: 'DBusConnection') -> bool
     |      Return self==value.
     |
     |  __init__(self, connection: jeepney.io.blocking.DBusConnection, item_path: str, session: Optional[secretstorage.dhcrypto.Session] = None) -> None
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  delete(self) -> None
     |      Deletes the item.
     |
     |  ensure_not_locked(self) -> None
     |      If collection is locked, raises
     |      :exc:`~secretstorage.exceptions.LockedException`.
     |
     |  get_attributes(self) -> Dict[str, str]
     |      Returns item attributes (dictionary).
     |
     |  get_created(self) -> int
     |      Returns UNIX timestamp (integer) representing the time
     |      when the item was created.
     |
     |      .. versionadded:: 1.1
     |
     |  get_label(self) -> str
     |      Returns item label (unicode string).
     |
     |  get_modified(self) -> int
     |      Returns UNIX timestamp (integer) representing the time
     |      when the item was last modified.
     |
     |  get_secret(self) -> bytes
     |      Returns item secret (bytestring).
     |
     |  get_secret_content_type(self) -> str
     |      Returns content type of item secret (string).
     |
     |  is_locked(self) -> bool
     |      Returns :const:`True` if item is locked, otherwise
     |      :const:`False`.
     |
     |  set_attributes(self, attributes: Dict[str, str]) -> None
     |      Sets item attributes to `attributes` (dictionary).
     |
     |  set_label(self, label: str) -> None
     |      Sets item label to `label`.
     |
     |  set_secret(self, secret: bytes, content_type: str = 'text/plain') -> None
     |      Sets item secret to `secret`. If `content_type` is given,
     |      also sets the content type of the secret (``text/plain`` by
     |      default).
     |
     |  unlock(self) -> bool
     |      Requests unlocking the item. Usually, this means that the
     |      whole collection containing this item will be unlocked.
     |
     |      Returns a boolean representing whether the prompt has been
     |      dismissed; that means :const:`False` on successful unlocking
     |      and :const:`True` if it has been dismissed.
     |
     |      .. versionadded:: 2.1.2
     |
     |      .. versionchanged:: 3.0
     |         No longer accepts the ``callback`` argument.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |
     |  __hash__ = None

### class ItemNotFoundException
     |  Raised when an item does not exist or has been deleted. Example of
     |  handling:
     |
     |  >>> import secretstorage
     |  >>> connection = secretstorage.dbus_init()
     |  >>> item_path = '/not/existing/path'
     |  >>> try:
     |  ...     item = secretstorage.Item(connection, item_path)
     |  ... except secretstorage.ItemNotFoundException:
     |  ...     print('Item not found!')
     |  ...
     |  Item not found!
     |
     |  Method resolution order:
     |      ItemNotFoundException
     |      SecretStorageException
     |      builtins.Exception
     |      builtins.BaseException
     |      builtins.object
     |
     |  Data descriptors inherited from SecretStorageException:
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.Exception:
     |
     |  __init__(self, /, *args, **kwargs)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.Exception:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.BaseException:
     |
     |  __delattr__(self, name, /)
     |      Implement delattr(self, name).
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __reduce__(...)
     |      Helper for pickle.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __setattr__(self, name, value, /)
     |      Implement setattr(self, name, value).
     |
     |  __setstate__(...)
     |
     |  __str__(self, /)
     |      Return str(self).
     |
     |  with_traceback(...)
     |      Exception.with_traceback(tb) --
     |      set self.__traceback__ to tb and return self.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from builtins.BaseException:
     |
     |  __cause__
     |      exception cause
     |
     |  __context__
     |      exception context
     |
     |  __dict__
     |
     |  __suppress_context__
     |
     |  __traceback__
     |
     |  args

### class LockedException
     |  Raised when an action cannot be performed because the collection
     |  is locked. Use :meth:`~secretstorage.collection.Collection.is_locked`
     |  to check if the collection is locked, and
     |  :meth:`~secretstorage.collection.Collection.unlock` to unlock it.
     |
     |  Method resolution order:
     |      LockedException
     |      SecretStorageException
     |      builtins.Exception
     |      builtins.BaseException
     |      builtins.object
     |
     |  Data descriptors inherited from SecretStorageException:
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.Exception:
     |
     |  __init__(self, /, *args, **kwargs)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.Exception:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.BaseException:
     |
     |  __delattr__(self, name, /)
     |      Implement delattr(self, name).
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __reduce__(...)
     |      Helper for pickle.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __setattr__(self, name, value, /)
     |      Implement setattr(self, name, value).
     |
     |  __setstate__(...)
     |
     |  __str__(self, /)
     |      Return str(self).
     |
     |  with_traceback(...)
     |      Exception.with_traceback(tb) --
     |      set self.__traceback__ to tb and return self.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from builtins.BaseException:
     |
     |  __cause__
     |      exception cause
     |
     |  __context__
     |      exception context
     |
     |  __dict__
     |
     |  __suppress_context__
     |
     |  __traceback__
     |
     |  args

### class PromptDismissedException
     |  Raised when a prompt was dismissed by the user.
     |
     |  .. versionadded:: 3.1
     |
     |  Method resolution order:
     |      PromptDismissedException
     |      ItemNotFoundException
     |      SecretStorageException
     |      builtins.Exception
     |      builtins.BaseException
     |      builtins.object
     |
     |  Data descriptors inherited from SecretStorageException:
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.Exception:
     |
     |  __init__(self, /, *args, **kwargs)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.Exception:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.BaseException:
     |
     |  __delattr__(self, name, /)
     |      Implement delattr(self, name).
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __reduce__(...)
     |      Helper for pickle.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __setattr__(self, name, value, /)
     |      Implement setattr(self, name, value).
     |
     |  __setstate__(...)
     |
     |  __str__(self, /)
     |      Return str(self).
     |
     |  with_traceback(...)
     |      Exception.with_traceback(tb) --
     |      set self.__traceback__ to tb and return self.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from builtins.BaseException:
     |
     |  __cause__
     |      exception cause
     |
     |  __context__
     |      exception context
     |
     |  __dict__
     |
     |  __suppress_context__
     |
     |  __traceback__
     |
     |  args

### class SecretServiceNotAvailableException
     |  Raised by :class:`~secretstorage.item.Item` or
     |  :class:`~secretstorage.collection.Collection` constructors, or by
     |  other functions in the :mod:`secretstorage.collection` module, when
     |  the Secret Service API is not available.
     |
     |  Method resolution order:
     |      SecretServiceNotAvailableException
     |      SecretStorageException
     |      builtins.Exception
     |      builtins.BaseException
     |      builtins.object
     |
     |  Data descriptors inherited from SecretStorageException:
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.Exception:
     |
     |  __init__(self, /, *args, **kwargs)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.Exception:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.BaseException:
     |
     |  __delattr__(self, name, /)
     |      Implement delattr(self, name).
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __reduce__(...)
     |      Helper for pickle.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __setattr__(self, name, value, /)
     |      Implement setattr(self, name, value).
     |
     |  __setstate__(...)
     |
     |  __str__(self, /)
     |      Return str(self).
     |
     |  with_traceback(...)
     |      Exception.with_traceback(tb) --
     |      set self.__traceback__ to tb and return self.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from builtins.BaseException:
     |
     |  __cause__
     |      exception cause
     |
     |  __context__
     |      exception context
     |
     |  __dict__
     |
     |  __suppress_context__
     |
     |  __traceback__
     |
     |  args

### class SecretStorageException
     |  All exceptions derive from this class.
     |
     |  Method resolution order:
     |      SecretStorageException
     |      builtins.Exception
     |      builtins.BaseException
     |      builtins.object
     |
     |  Data descriptors defined here:
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.Exception:
     |
     |  __init__(self, /, *args, **kwargs)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.Exception:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.BaseException:
     |
     |  __delattr__(self, name, /)
     |      Implement delattr(self, name).
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __reduce__(...)
     |      Helper for pickle.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __setattr__(self, name, value, /)
     |      Implement setattr(self, name, value).
     |
     |  __setstate__(...)
     |
     |  __str__(self, /)
     |      Return str(self).
     |
     |  with_traceback(...)
     |      Exception.with_traceback(tb) --
     |      set self.__traceback__ to tb and return self.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from builtins.BaseException:
     |
     |  __cause__
     |      exception cause
     |
     |  __context__
     |      exception context
     |
     |  __dict__
     |
     |  __suppress_context__
     |
     |  __traceback__
     |
     |  args

## FUNCTIONS
### check_service_availability
        Returns True if the Secret Service daemon is either running or
        available for activation via D-Bus, False otherwise.

        .. versionadded:: 3.2

### create_collection
        Creates a new :class:`Collection` with the given `label` and `alias`
        and returns it. This action requires prompting.

        :raises: :exc:`~secretstorage.exceptions.PromptDismissedException`
                 if the prompt is dismissed.

### dbus_init
        Returns a new connection to the session bus, instance of
        jeepney's :class:`DBusConnection` class. This connection can
        then be passed to various SecretStorage functions, such as
        :func:`~secretstorage.collection.get_default_collection`.

        .. warning::
           The D-Bus socket will not be closed automatically. You can
           close it manually using the :meth:`DBusConnection.close` method,
           or you can use the :class:`contextlib.closing` context manager:

           .. code-block:: python

              from contextlib import closing
              with closing(dbus_init()) as conn:
                  collection = secretstorage.get_default_collection(conn)
                  items = collection.search_items({'application': 'myapp'})

           However, you will not be able to call any methods on the objects
           created within the context after you leave it.

        .. versionchanged:: 3.0
           Before the port to Jeepney, this function returned an
           instance of :class:`dbus.SessionBus` class.

        .. versionchanged:: 3.1
           This function no longer accepts any arguments.

### get_all_collections
        Returns a generator of all available collections.

### get_any_collection
        Returns any collection, in the following order of preference:

        - The default collection;
        - The "session" collection (usually temporary);
        - The first collection in the collections list.

### get_collection_by_alias
        Returns the collection with the given `alias`. If there is no
        such collection, raises
        :exc:`~secretstorage.exceptions.ItemNotFoundException`.

### get_default_collection
        Returns the default collection. If it doesn't exist,
        creates it.

### search_items
        Returns a generator of items in all collections with the given
        attributes. `attributes` should be a dictionary.

## DATA
    __all__ = ['Collection', 'Item', 'ItemNotFoundException', 'LockedExcep...
    __version_tuple__ = (3, 3, 1)

## VERSION
    3.3.1

## FILE
    /usr/lib/python3/dist-packages/secretstorage/__init__.py


