:right-sidebar: True Importer =================================================================== .. currentmodule:: gi.repository.Gcr .. class:: Importer(*args, **kwargs) :no-contents-entry: An interface which allows importing of certificates and keys. Each importer is registered with a set of PKCS``11`` attributes to match stuff that it can import. An importer gets passed a :obj:`~gi.repository.Gcr.Parser` and accesses the currently parsed item. To create a set of importers that can import the currently parsed item in a parser, use :obj:`~gi.repository.Importer.create_for_parsed`\. The list of importers returned has the parsed item queued for import. To queue additional items with a importer use :obj:`~gi.repository.Importer.queue_for_parsed`\. In addition you can try and queue an additional item with a set of importers using the :obj:`~gi.repository.Importer.queue_and_filter_for_parsed`\. To start the import, use :obj:`~gi.repository.Importer.import_async`\. Methods ------- .. rst-class:: interim-class .. class:: Importer :no-index: .. classmethod:: create_for_parsed() -> list[~gi.repository.Gcr.Importer] Create a set of importers which can import this parsed item. The parsed item is represented by the state of the GcrParser at the time of calling this method. .. method:: get_interaction() -> ~gi.repository.Gio.TlsInteraction | None Get the interaction used to prompt the user when needed by this importer. .. method:: import_async(cancellable: ~gi.repository.Gio.Cancellable | None = None, callback: ~typing.Callable[[~gi.repository.GObject.Object | None, ~gi.repository.Gio.AsyncResult, ~typing.Any], None] | None = None, user_data: ~typing.Any = None) -> None Import the queued items in the importer. This function returns immediately and completes asynchronously. :param cancellable: a :obj:`~gi.repository.Gio.Cancellable`\, or :const:`None` :param callback: called when the operation completes :param user_data: data to be passed to the callback .. method:: import_finish(result: ~gi.repository.Gio.AsyncResult) -> bool Complete an asynchronous operation to import queued items. :param result: an asynchronous result .. classmethod:: queue_and_filter_for_parsed(parsed: ~gi.repository.Gcr.Parsed) -> list[~gi.repository.Gcr.Importer] Queues an additional item to be imported in all compattible importers in the set. The parsed item is represented by the state of the :obj:`~gi.repository.Gcr.Parser` at the time of calling this method. If the parsed item is incompatible with an importer, then that the item will not be queued on that importer. :param parsed: a parsed item .. method:: queue_for_parsed(parsed: ~gi.repository.Gcr.Parsed) -> bool Queues an additional item to be imported. The parsed item is represented by the state of the :obj:`~gi.repository.Gcr.Parser` at the time of calling this method. If the parsed item is incompatible with the importer, then this will fail and the item will not be queued. :param parsed: a parsed item to import .. classmethod:: register(attrs: ~gi.repository.Gck.Attributes) -> None Register an importer to handle parsed items that match the given attributes. :param attrs: the attributes that this importer is compatible with .. classmethod:: register_well_known() -> None Register built-in PKCS``11`` and GnuPG importers. .. method:: set_interaction(interaction: ~gi.repository.Gio.TlsInteraction) -> None Set the interaction used to prompt the user when needed by this importer. :param interaction: the interaction used by the importer Properties ---------- .. rst-class:: interim-class .. class:: Importer :no-index: .. attribute:: props.interaction :type: ~gi.repository.Gio.TlsInteraction The type of the None singleton. .. attribute:: props.label :type: str The type of the None singleton. .. attribute:: props.uri :type: str The type of the None singleton. Virtual Methods --------------- .. rst-class:: interim-class .. class:: Importer :no-index: .. method:: do_import_async(cancellable: ~gi.repository.Gio.Cancellable | None = None, callback: ~typing.Callable[[~gi.repository.GObject.Object | None, ~gi.repository.Gio.AsyncResult, ~typing.Any], None] | None = None, user_data: ~typing.Any = None) -> None Import the queued items in the importer. This function returns immediately and completes asynchronously. :param cancellable: a :obj:`~gi.repository.Gio.Cancellable`\, or :const:`None` :param callback: called when the operation completes :param user_data: data to be passed to the callback .. method:: do_import_finish(result: ~gi.repository.Gio.AsyncResult) -> bool Complete an asynchronous operation to import queued items. :param result: an asynchronous result .. method:: do_queue_for_parsed(parsed: ~gi.repository.Gcr.Parsed) -> bool Queues an additional item to be imported. The parsed item is represented by the state of the :obj:`~gi.repository.Gcr.Parser` at the time of calling this method. If the parsed item is incompatible with the importer, then this will fail and the item will not be queued. :param parsed: a parsed item to import