Skip to main content

Python wrapper to interact with the Eurogard m2v IoT platform

Project description

pym2v

CI Docs PyPI

Python wrapper to interact with m2v industrial IoT platform from Eurogard.

Prerequisites

  • Python 3.12+
  • Programmatic access to the Eurogard API

Installation

pym2v is available as a Python package and can be installed via pip or uv.

Via pip

  1. Create a virtual environment: python3 -m venv .venv
  2. Activate the virtual environment: source .venv/bin/active
  3. Install pym2v via pip: pip install pym2v

Via uv

  1. Install pym2v via uv: uv add pym2v

Configuration

To authenticate with the Eurogard API, you need to provide the following credentials:

  • Username
  • Password
  • Client ID
  • Client Secret

You can do this either by using an .env file or by setting environment variables directly.

Using an .env file

Rename the .env.example at the root of the project to .env, and replace the placeholder values with your actual credentials.

EUROGARD_BASEURL=https://eurogard.cloud
EUROGARD_USERNAME=your_username_here
EUROGARD_PASSWORD=your_password_here
EUROGARD_CLIENT_ID=your_client_id_here
EUROGARD_CLIENT_SECRET=your_client_secret_here

Usage

Import the EurogardAPI object and create an instance of it

from datetime import datetime, timedelta

from pym2v.api import EurogardAPI


api = EurogardAPI()

Retrieve a list of machines

machines = api.get_machines()

Get the UUID of the machine your are interested in

MACHINE_NAME = "1337Machine"

machine_uuid = api.get_machine_uuid(MACHINE_NAME, machines)

Get the names of measurements for which you like to pull data

result = api.get_machine_measurement_names(machine_uuid)

Turn the data returned by the API into a DataFrame for easier handling

import polars as pl

measurement_names_df = pl.DataFrame(result["entities"])

Get actual data

START_DATE = datetime(2025, 1, 1)
END_DATE = datetime(2025, 1, 13)
INTERVAL = timedelta(seconds=60)
MAX_FRAME_LENGTH = timedelta(days=30)
NAMES = [col.strip() for col in measurement_names_df.get_column("name").to_list()]

data_df = api.get_long_frame_from_names(
    machine_uuid=machine_uuid,
    names=NAMES,
    start=START_DATE,
    end=END_DATE,
    interval=INTERVAL,
    max_frame_length=MAX_FRAME_LENGTH,
)

Contributing

Check out CONTRIBUTING.md for further information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pym2v-0.2.0.tar.gz (20.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pym2v-0.2.0-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

Details for the file pym2v-0.2.0.tar.gz.

File metadata

  • Download URL: pym2v-0.2.0.tar.gz
  • Upload date:
  • Size: 20.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pym2v-0.2.0.tar.gz
Algorithm Hash digest
SHA256 48fbd12ca18d6cead890e8ca5d73384102cb6827cde4e8b8af5c333af4ba0d27
MD5 5474c10ae3897df7290464a5ae6dc787
BLAKE2b-256 ec7d76811c5231f7ef8794698e7f64bf967c52173251957751ab9350e0839861

See more details on using hashes here.

File details

Details for the file pym2v-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pym2v-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 20.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pym2v-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 204299ffbb1c40792166d98c831b37db7ceecc35da27c949aa45c2a5a9bcfeca
MD5 37f81634bbcdee5a1af1295ba121e0ec
BLAKE2b-256 cf36731fe2b9b080438ec7134571ee9dd066ad363a0992eeb8aab331ff8910c6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page