Skip to main content

Vesikanta manager

PyPI version

Vesikanta package provides all necessary functionality to automate tasks related to customer and real estate management, billing, and data transfers within the Vesikanta system.

[!NOTE] Functions currently not used are marked with NOTE: NOT IN USE This is related to the issue with checking tracking data programmatically. These functions are currently placeholder functions just to save development time if "Seurantatietojen keruu" becomes possible to do programmatically.

Requirements

  • robocorp >= 2.1.0
  • robocorp-windows >= 1.0.4
  • pydantic >= 2.9.2
  • email-validator >= 2.2.0
  • pyautogui >= 0.9.54
  • pandas >= 2.2.3

How to develop

  1. Clone the repository and navigate to the root folder
  2. Install or upgrade build by running: py -m pip install --upgrade build
  3. Generate distribution packages for the package with command: python -m build This command will generate a source distribution (tar.gz) and a wheel (whl) in a dist/ folder.
dist/
├── example_package-1.0.0-py3-none-any.whl
└── example_package-1.0.0.tar.gz
  1. Create a devtask-folder that contains the following files (sema4.ai create task package)
devtask/
├── .gitignore
├── conda.yaml
├── config.json
├── config.py
├── tasks.py

File examples:

.gitignore
  • .gitignore file is just the default one coming with sema4.ai create task package. This can be left out, but conda.yaml file will recognize it missing and warn about it.
output/
venv/
temp/
.rpa/
.idea/
.ipynb_checkpoints/
*/.ipynb_checkpoints/*
.virtual_documents/
*/.virtual_documents/*
.vscode
.DS_Store
*.pyc
*.zip
*/work-items-out/*
testrun/*
.~lock*
*.pkl
conda.yaml
  • conda.yaml Here the package is installed in editable mode.
# For more details on the format and content:
# https://github.com/robocorp/rcc/blob/master/docs/recipes.md#what-is-in-condayaml
# Tip: Adding a link to the release notes of the packages helps maintenance and security.

channels:
  - conda-forge

dependencies:
  - python=3.10.12                # https://pyreadiness.org/3.10
  - pip=23.2.1                    # https://pip.pypa.io/en/stable/news
  - robocorp-truststore=0.8.0     # https://pypi.org/project/robocorp-truststore/
  - pip:
    - robocorp==2.1.0             # https://pypi.org/project/robocorp
    - robocorp-windows==1.0.4     # https://pypi.org/project/robocorp-browser
    - pydantic==2.9.2             # https://pypi.org/project/pydantic
    - email-validator==2.2.0      # https://pypi.org/project/email-validator/
    - pyautogui==0.9.54           # https://pypi.org/project/PyAutoGUI
    - pandas==2.2.3               # https://pandas.pydata.org

rccPostInstall:
  - pip install -e "..\\..\\riverit-vesikanta-manager"
config.json
  • This is the layout of correct configuration in json format. Values must be changed accordingly
{
    "vesikanta_path": "path_to_the_application_exe",
    "vesikanta_creds": "vesikanta_secrets_within_cloud",
    "reading_report_files_path": "robot_working_folder_for_reading_files",
    "reading_report_files_archive_path": "robot_archive_folder_for_reading_files",
    "tracking_report_files_path": "robot_working_folder_for_tracking_files",
    "tracking_report_files_archive_path": "robot_archive_folder_for_tracking_files",
    "ufile_path": "robot_working_folder",
    "customer_group_start": "group_number",
    "customer_group_end": "group_number",
    "email_creds": "email_secrets_within_cloud",
    "email_sender": "sender@mail.com",
    "email_recipients": ["reciever@mail.com"],
    "email_subject": "subject_of_email",
    "email_body": "body_of_email",
    "date_format": "%Y%m%d_%H%M",
    "signature": "name_for_signature",
    "column_p_regex_list": ["item1","item2"]
}
config.py
  • Used to differentiate between development and production environments and load corresponding json configuration
import json
import os

from pydantic import ValidationError
from robocorp import log, storage

from riverit_vesikanta_manager import Config


def read_config(config_name: str) -> Config:
    """
    Reads the configuration based on the runtime environment.
    Automatically determines if it should read from a local (development) config or asset (production) config.

    Args:
        `config_name` (str): The name of the configuration file to read from robocorp cloud.

    Returns:
        `config` (Config): The configuration data.

    Raises:
        `Exception`: If there is an error while reading the configuration.
    """
    # Check for an environment variable to determine the runtime environment
    dev_env = os.getenv("RUNTIME_ENV") == "dev"
    config = None

    if dev_env:
        try:
            with open("config.json", "r", encoding="utf-8") as file:
                config_data = json.load(file)
                log.info("Read local config.")
        except Exception as e:
            raise Exception(f"Failed to read local config: {e}")
    else:
        try:
            config_data = storage.get_json(config_name)
            log.info("Read asset config.")
        except Exception as e:
            raise Exception(f"Failed to read asset config: {e}")

    try:
        config = Config(**config_data)
    except ValidationError as e:
        raise Exception(f"Failed to validate config: {e}")

    return config
robot.yaml
  • Default file coming when creating task package
# For more details on the format and content:
# https://github.com/robocorp/rcc/blob/master/docs/recipes.md#what-is-in-robotyaml

tasks:
  Run Task:
    shell: python -m robocorp.tasks run tasks.py

environmentConfigs:
  - environment_windows_amd64_freeze.yaml
  - environment_linux_amd64_freeze.yaml
  - environment_darwin_amd64_freeze.yaml
  - conda.yaml

artifactsDir: output

PATH:
  - .
PYTHONPATH:
  - .
ignoreFiles:
  - .gitignore
tasks.py
  • Minimal task to test the package with. This should log in Vesikanta and close the application immediately afterwards.
from config import read_config
from robocorp.tasks import task

from riverit_vesikanta_manager import VesikantaManager

config = read_config("cloud_config_name")

vk = VesikantaManager(config)


@task
def minimal_task():
    with vk:
        print("onnistui")

  1. Create .env file in the root folder with following values, to use the local config.json from the devtask folder

.env

RUNTIME_ENV = "dev"

Metadata

Release files for riverit-vesikanta-manager 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for riverit-vesikanta-manager 0.2.0
File Size Uploaded Provenance Actions
riverit_vesikanta_manager-0.2.0.tar.gz 28.8 kB Without provenance Details for riverit_vesikanta_manager-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for riverit-vesikanta-manager 0.2.0
File Interpreter ABI Platform Actions
riverit_vesikanta_manager-0.2.0-py3-none-any.whl Python 3 none any Details for riverit_vesikanta_manager-0.2.0-py3-none-any.whl

Total release size: 62.2 kB

Release files / riverit_vesikanta_manager-0.2.0.tar.gz

Download URL riverit_vesikanta_manager-0.2.0.tar.gz
Size 28.8 kB
Tags Source
SHA-256 checksum
How to use checksums
48a1fc147dc20a28eaf22a4d050b3e87cb45dee97861b8b1e12fe74faba6445c
BLAKE2b-256 checksum
How to use checksums
82c65ce9f2565bfd620579edaa0e12e2e247cfaf83630797db6289aa84215e16
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.20

Release files / riverit_vesikanta_manager-0.2.0-py3-none-any.whl

Download URL riverit_vesikanta_manager-0.2.0-py3-none-any.whl
Size 33.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0dae5c9d4a829c071e116e3883dd55cf60d210c0a9ce18011471c78a2f1b2d5f
BLAKE2b-256 checksum
How to use checksums
b12d1b20d92ff8718f33244590b94f9b9387c3a90da15617e020fc21b18541a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.20

Security for riverit-vesikanta-manager 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page