Class: QgsServiceRegistry

A registry manager for QGIS server services.

This class provides methods for registering and retrieving services.

IMPORTANT: The registry hold ownership of registered services and will call ‘delete’ on cleanup

class qgis.server.QgsServiceRegistry[source]

Bases: object

cleanUp(self)[source]

Clean up registered service and unregister modules

getApi(self, name: str | None, version: str | None = '') QgsServerApi | None[source]

Retrieves an API from its name

If the version is not provided the higher version of the service is returned

Parameters:
  • name (Optional[str]) – the name of the API

  • version (Optional[str] = '') – the version string (optional)

Return type:

Optional[QgsServerApi]

Returns:

QgsServerApi

Added in version 3.10.

getService(self, name: str | None, version: str | None = '') QgsService | None[source]

Retrieve a service from its name

Parameters:
  • name (Optional[str]) – the name of the service

  • version (Optional[str] = '') – the version string (optional)

Return type:

Optional[QgsService]

Returns:

QgsService

If the version is not provided the higher version of the service is returned

init(self, nativeModulepath: str | None, serverIface: QgsServerInterface | None = None)[source]

Initialize registry, load modules and auto register services

Parameters:
  • serverIface (Optional[QgsServerInterface] = None) – the server interface

  • nativeModulepath (Optional[str]) – the native module path

registerApi(self, api: QgsServerApi | None) bool[source]

Registers the QgsServerApi api

The registry takes ownership of services and will call ‘delete’ on cleanup

Added in version 3.10.

Parameters:

api (Optional[QgsServerApi])

Return type:

bool

registerService(self, service: QgsService | None)[source]

Register a service by its name and version

This method is intended to be called by modules for registering services. A module may register multiple services.

The registry takes ownership of services and will call ‘delete’ on cleanup

Parameters:

service (Optional[QgsService]) – a QgsService to be registered

unregisterApi(self, name: str | None, version: str | None = '') int[source]

Unregisters API from its name and version

Parameters:
  • name (Optional[str]) – the name of the service

  • version (Optional[str] = '') – (optional) the specific version to unload

Return type:

int

Returns:

the number of APIs unregistered

If the version is not specified then all versions from the specified API are unloaded

Added in version 3.10.

unregisterService(self, name: str | None, version: str | None = '') int[source]

Unregister service from its name and version

Parameters:
  • name (Optional[str]) – the name of the service

  • version (Optional[str] = '') – (optional) the specific version to unload

Return type:

int

Returns:

the number of services unregistered

If the version is not specified then all versions from the specified service are unloaded