pas.cli

Attributes

Processor

log

cli

Functions

import_commission_data(→ Processor)

Note: This is deprecated, not really used, as we have the JSON import.

update_accounts_cli(→ Processor)

Updates user accounts for parliamentarians.

check_api(→ None)

Check if the KuB API is reachable.

import_kub_data(→ Processor)

Import data from the KUB API endpoints.

update_custom_data(→ Processor)

Update parliamentarians with customFields data which

Module Contents

type pas.cli.Processor = Callable[[PasRequest, PasApp], None][source]
pas.cli.log[source]
pas.cli.cli[source]
pas.cli.import_commission_data(excel_file: str) Processor[source]

Note: This is deprecated, not really used, as we have the JSON import.

Import commission data from an Excel or csv file.

Assumes that the name of the commission is the filename.

Each row of this import contains a single line, which is a single parliamentarian and all the information about them.

Example:

onegov-pas –select ‘/onegov_pas/zug’ import-commission-data “Kommission_Gesundheit_und_Soziales.xlsx”

pas.cli.update_accounts_cli(dry_run: bool) Processor[source]

Updates user accounts for parliamentarians.

pas.cli.check_api(url: str, token: str) None[source]

Check if the KuB API is reachable.

Example:

onegov-pas check-api –token “your-token-here”

pas.cli.import_kub_data(token: str, base_url: str, update_custom: bool, max_workers: int) Processor[source]

Import data from the KUB API endpoints.

Fetches data from /people, /organizations, and /memberships endpoints and imports them using the existing import logic. Optionally updates parliamentarians with custom field data from individual API calls using multi-threaded processing for improved performance.

Example:

onegov-pas –select ‘/onegov_pas/zug’ import-kub-data –token “your-token-here”

# Skip custom data update: onegov-pas –select ‘/onegov_pas/zug’ import-kub-data –token “your-token-here” –no-update-custom

# Use more workers for faster custom data processing: onegov-pas –select ‘/onegov_pas/zug’ import-kub-data –token “your-token-here” –max-workers 5

pas.cli.update_custom_data(token: str, base_url: str, max_workers: int) Processor[source]

Update parliamentarians with customFields data which somehow is not included in the main /people api. Needs to be run after import_kub_data

Uses multi-threading to fetch custom data concurrently from the API while maintaining thread-safe database operations.

Example:

onegov-pas –select ‘/onegov_pas/zug’ update-custom-data –token “your-token-here” –base-url “url-ending-in/api/v2”

# Use more workers for faster processing: onegov-pas –select ‘/onegov_pas/zug’ update-custom-data –token “your-token-here” –base-url “url-ending-in/api/v2” –max-workers 5