ahriman.web.views package
Subpackages
- ahriman.web.views.api package
- ahriman.web.views.v1 package
- Subpackages
- ahriman.web.views.v1.auditlog package
- ahriman.web.views.v1.distributed package
- ahriman.web.views.v1.packages package
- Submodules
- ahriman.web.views.v1.packages.changes module
- ahriman.web.views.v1.packages.dependencies module
- ahriman.web.views.v1.packages.logs module
- ahriman.web.views.v1.packages.package module
- ahriman.web.views.v1.packages.packages module
- ahriman.web.views.v1.packages.patch module
- ahriman.web.views.v1.packages.patches module
- Module contents
- ahriman.web.views.v1.service package
- Submodules
- ahriman.web.views.v1.service.add module
- ahriman.web.views.v1.service.config module
- ahriman.web.views.v1.service.logs module
- ahriman.web.views.v1.service.pgp module
- ahriman.web.views.v1.service.process module
- ahriman.web.views.v1.service.rebuild module
- ahriman.web.views.v1.service.remove module
- ahriman.web.views.v1.service.request module
- ahriman.web.views.v1.service.search module
- ahriman.web.views.v1.service.update module
- ahriman.web.views.v1.service.upload module
- Module contents
- ahriman.web.views.v1.status package
- ahriman.web.views.v1.user package
- Module contents
- Subpackages
- ahriman.web.views.v2 package
Submodules
ahriman.web.views.base module
- class BaseView(request: None)
Bases:
View,CorsViewMixinbase web view to make things typed
- OPTIONS_PERMISSION
(class attribute) options permissions of self
- Type:
- ROUTES
(class attribute) list of supported routes
- Type:
list[str]
- async classmethod get_permission(request: Request) UserAccess
retrieve user permission from the request
- Parameters:
request (Request) – request object
- Returns:
extracted permission
- Return type:
- classmethod routes(configuration: Configuration) list[str]
extract routes list for the view
- Parameters:
configuration (Configuration) – configuration instance
- Returns:
list of routes defined for the view. By default, it tries to read
ROUTESoption if set and returns empty list otherwise- Return type:
list[str]
- static get_non_empty(extractor: Callable[[str], T | None], key: str) T
get non-empty value from request parameters
- Parameters:
extractor (Callable[[str], T | None]) – function to get value
key (str) – key to extract value
- Returns:
extracted values if it is presented and not empty
- Return type:
T
- Raises:
KeyError – in case if key was not found or value is empty
- static json_response(data: dict[str, Any] | list[Any], **kwargs: Any) Response
filter and convert data and return
aiohttp.web.Responseobject- Parameters:
data (dict[str, Any] | list[Any]) – response in json format
**kwargs (Any) – keyword arguments for
aiohttp.web.json_response()function
- Returns:
generated response object
- Return type:
Response
- async head() StreamResponse
HEAD method implementation based on the result of GET method
- Returns:
generated response for the request
- Return type:
StreamResponse
- Raises:
HTTPMethodNotAllowed – in case if there is no GET method implemented
- page() tuple[int, int]
parse limit and offset and return values
- Returns:
limit and offset from request
- Return type:
tuple[int, int]
- Raises:
HTTPBadRequest – if supplied parameters are invalid
- repository_id() RepositoryId
extract repository from request
- Returns:
repository if possible to construct and first one otherwise
- Return type:
RepositoryIde
- service(repository_id: RepositoryId | None = None, package_base: str | None = None) Watcher
get status watcher instance
- Parameters:
repository_id (RepositoryId | None, optional) – repository unique identifier (Default value = None)
package_base (str | None, optional) – package base to validate if exists (Default value = None)
- Returns:
build status watcher instance. If no repository provided, it will return the first one
- Return type:
- Raises:
HTTPNotFound – if no repository found
- async username() str | None
extract username from request if any
- Returns:
authorized username if any and
Noneotherwise (e.g. if authorization is disabled)- Return type:
str | None
- property configuration: Configuration
get configuration instance
- Returns:
configuration instance
- Return type:
- property services: dict[RepositoryId, Watcher]
get all loaded watchers
- Returns:
map of loaded watchers per known repository
- Return type:
dict[RepositoryId, Watcher]
- property spawner: Spawn
get process spawner instance
- Returns:
external process spawner instance
- Return type:
- property validator: Auth
get authorization instance
- Returns:
authorization service instance
- Return type:
- property workers: WorkersCache
get workers cache instance
- Returns:
workers service
- Return type:
ahriman.web.views.index module
- class IndexView(request: None)
Bases:
BaseViewroot view
It uses jinja2 templates for report generation, the following variables are allowed:
- auth - authorization descriptor, required
control - HTML to insert for login control, HTML string, required
enabled - whether authorization is enabled by configuration or not, boolean, required
username - authenticated username if any, string, null means not authenticated
- autorefresh_intervals - auto refresh intervals, optional
interval - auto refresh interval in milliseconds, integer, required
is_active - is current interval active or not, boolean, required
text - text representation of the interval (e.g. “30 seconds”), string, required
docs_enabled - indicates if api docs is enabled, boolean, required
index_url - url to the repository index, string, optional
- repositories - list of repositories unique identifiers, required
id - unique repository identifier, string, required
repository - repository name, string, required
architecture - repository architecture, string, required
version - service version, string, required
- GET_PERMISSION
(class attribute) get permissions of self
- Type:
- async get() Response
process get request. No parameters supported here
- Returns:
200 with rendered index page
- Return type:
Response
ahriman.web.views.static module
- class StaticView(request: None)
Bases:
BaseViewspecial workaround for static files redirection (e.g. favicon)
- GET_PERMISSION
(class attribute) get permissions of self
- Type:
- async get() None
process get request. No parameters supported here
- Raises:
HTTPFound – on success response
HTTPNotFound – if path is invalid or unknown
ahriman.web.views.status_view_guard module
- class StatusViewGuard
Bases:
objecthelper for check if status routes are enabled
- classmethod routes(configuration: Configuration) list[str]
extract routes list for the view
- Parameters:
configuration (Configuration) – configuration instance
- Returns:
list of routes defined for the view. By default, it tries to read
ROUTESoption if set and returns empty list otherwise- Return type:
list[str]