ahriman.core.report package
Submodules
ahriman.core.report.console module
- class Console(repository_id: RepositoryId, configuration: Configuration, section: str)
Bases:
Report
html report generator
- use_utf
print utf8 symbols instead of ASCII
- Type:
bool
default constructor
- Parameters:
repository_id (RepositoryId) – repository unique identifier
configuration (Configuration) – configuration instance
section (str) – settings section name
ahriman.core.report.email module
- class Email(repository_id: RepositoryId, configuration: Configuration, section: str)
Bases:
Report
,JinjaTemplate
email report generator
- host
SMTP host to connect
- Type:
str
- no_empty_report
skip empty report generation
- Type:
bool
- password
password to authenticate via SMTP
- Type:
str | None
- port
SMTP port to connect
- Type:
int
- receivers
list of receivers emails
- Type:
list[str]
- sender
sender email address
- Type:
str
- ssl
SSL mode for SMTP connection
- Type:
- template
path or name to template for built packages
- Type:
Path | str
- template_full
path or name to template for full package list
- Type:
Path | str | None
- user
username to authenticate via SMTP
- Type:
str | None
default constructor
- Parameters:
repository_id (RepositoryId) – repository unique identifier
configuration (Configuration) – configuration instance
section (str) – settings section name
ahriman.core.report.html module
- class HTML(repository_id: RepositoryId, configuration: Configuration, section: str)
Bases:
Report
,JinjaTemplate
html report generator
- report_path
output path to html report
- Type:
Path
- template
name or path to template for full package list
- Type:
Path | str
default constructor
- Parameters:
repository_id (RepositoryId) – repository unique identifier
configuration (Configuration) – configuration instance
section (str) – settings section name
ahriman.core.report.jinja_template module
- class JinjaTemplate(repository_id: RepositoryId, configuration: Configuration, section: str)
Bases:
object
jinja based report generator
It uses jinja2 templates for report generation, the following variables are allowed:
homepage - link to homepage, string, optional
link_path - prefix fo packages to download, string, required
has_package_signed - True in case if package sign enabled, False otherwise, required
has_repo_signed - True in case if repository database sign enabled, False otherwise, required
- packages - sorted list of packages properties, required
architecture, string
archive_size, pretty printed size, string
build_date, pretty printed datetime, string
depends, sorted list of strings
description, string
filename, string,
groups, sorted list of strings
installed_size, pretty printed datetime, string
licenses, sorted list of strings
name, string
url, string
version, string
pgp_key - default PGP key ID, string, optional
repository - repository name, string, required
- default_pgp_key
default PGP key
- Type:
str | None
- homepage
homepage link if any (for footer)
- Type:
str | None
- link_path
prefix fo packages to download
- Type:
str
- name
repository name
- Type:
str
- sign_targets
targets to sign enabled in configuration
- Type:
set[SignSettings]
- templates
list of directories with templates
- Type:
list[Path]
default constructor
- Parameters:
repository_id (RepositoryId) – repository unique identifier
configuration (Configuration) – configuration instance
section (str) – settings section name
ahriman.core.report.remote_call module
- class RemoteCall(repository_id: RepositoryId, configuration: Configuration, section: str)
Bases:
Report
trigger implementation which call remote service with update
- update_aur
check for AUR updates
- Type:
bool
- update_local
check for local packages update
- Type:
bool
- update_manual
check for manually built packages
- Type:
bool
- wait_timeout
timeout to wait external process
- Type:
int
default constructor
- Parameters:
repository_id (RepositoryId) – repository unique identifier
configuration (Configuration) – configuration instance
section (str) – settings section name
- is_process_alive(process_id: str) bool
check if process is alive
- Parameters:
process_id (str) – remote process id
- Returns:
True in case if remote process is alive and False otherwise
- Return type:
bool
- remote_update() str
call remote server for update
- Returns:
remote process id
- Return type:
str
- remote_wait(process_id: str) None
wait for remote process termination
- Parameters:
process_id (str) – remote process id
ahriman.core.report.report module
- class Report(repository_id: RepositoryId, configuration: Configuration)
Bases:
LazyLogging
base report generator
- configuration
configuration instance
- Type:
- repository_id
repository unique identifier
- Type:
Examples
Report
subclasses provide several method in order to operate with the report generation and additional class methodload()
which can be used in order to determine right report instance:>>> configuration = Configuration() >>> report = Report.load(RepositoryId("x86_64", "aur-clone"), configuration, "email")
The
generate()
method can be used in order to perform the report itself, whereasrun()
method handles exception and raisesahriman.core.exceptions.ReportError
instead:>>> try: >>> report.generate([], Result()) >>> except Exception as exception: >>> handle_exceptions(exception) >>> >>> report.run(Result(), [])
default constructor
- Parameters:
repository_id (RepositoryId) – repository unique identifier
configuration (Configuration) – configuration instance
- static load(repository_id: RepositoryId, configuration: Configuration, target: str) Report
load client from settings
- Parameters:
repository_id (RepositoryId) – repository unique identifier
configuration (Configuration) – configuration instance
target (str) – target to generate report aka section name (e.g. html)
- Returns:
client according to current settings
- Return type:
ahriman.core.report.report_trigger module
- class ReportTrigger(repository_id: RepositoryId, configuration: Configuration)
Bases:
Trigger
report trigger
- targets
report target list
- Type:
list[str]
default constructor
- Parameters:
repository_id (RepositoryId) – repository unique identifier
configuration (Configuration) – configuration instance
- classmethod configuration_sections(configuration: Configuration) list[str]
extract configuration sections from configuration
- Parameters:
configuration (Configuration) – configuration instance
- Returns:
read configuration sections belong to this trigger
- Return type:
list[str]
ahriman.core.report.telegram module
- class Telegram(repository_id: RepositoryId, configuration: Configuration, section: str)
Bases:
Report
,JinjaTemplate
,SyncHttpClient
telegram report generator
- TELEGRAM_API_URL
(class attribute) telegram api base url
- Type:
str
- TELEGRAM_MAX_CONTENT_LENGTH
(class attribute) max content length of the message
- Type:
int
- api_key
bot api key
- Type:
str
- chat_id
chat id to post message, either string with @ or integer
- Type:
str
- template
name or path to template for built packages
- Type:
Path | str
- template_type
template message type to be used in parse mode, one of MarkdownV2, HTML, Markdown
- Type:
str
default constructor
- Parameters:
repository_id (RepositoryId) – repository unique identifier
configuration (Configuration) – configuration instance
section (str) – settings section name