Subgroup: Credentials

Class: QgsCredentials

class qgis.core.QgsCredentials

Bases: sip.wrapper

Constructor for QgsCredentials.

Interface for requesting credentials in QGIS in GUI independent way. This class provides abstraction of a dialog for requesting credentials to the user. By default QgsCredentials will be used if not overridden with other credential creator function.

QGIS application uses QgsCredentialDialog class for displaying a dialog to the user.

Object deletes itself when it’s not needed anymore. Children should use signal destroyed() to be notified of the deletion

Methods

get
getMasterPassword
instance retrieves instance
lock Lock the instance against access from multiple threads.
mutex Returns pointer to mutex
put
request request a password
requestMasterPassword request a master password
setInstance register instance
unlock Unlock the instance after being locked.

Signals

Attributes

get(self, realm: str, username: str, password: str, message: str = '') → Tuple[bool, str, str]
getMasterPassword(self, password: str, stored: bool = False) → Tuple[bool, str]
instance() → QgsCredentials

retrieves instance

lock(self)

Lock the instance against access from multiple threads. This does not really lock access to get/put methds, it will just prevent other threads to lock the instance and continue the execution. When the class is used from non-GUI threads, they should call lock() before the get/put calls to avoid race conditions.

New in version 2.4.

mutex(self) → QMutex

Returns pointer to mutex

New in version 2.4.

put(self, realm: str, username: str, password: str)
request(self, realm: str, username: str, password: str, message: str = '') → Tuple[bool, str, str]

request a password

requestMasterPassword(self, password: str, stored: bool = False) → Tuple[bool, str]

request a master password

setInstance(self, instance: QgsCredentials)

register instance

unlock(self)

Unlock the instance after being locked.

New in version 2.4.