Skip to main content

A professional library for PI Web API integration

Project description

piwebapiconnect

A professional Python library for PI Web API integration.

Installation

pip install piwebapiconnect

Usage

Using .env file

Create a .env file in your project root with the following variables:

PI_WEB_API_URL=https://your-pi-server/piwebapi
PI_WEB_API_USERNAME=domain\user
PI_WEB_API_PASSWORD=your-password
PI_SERVER_NAME=PISERVER01
PI_WEB_API_VERIFY_SSL=True  # Optional, defaults to True
from piwebapiconnect import get_service
service = get_service()

Functions Provided

All service functions are asynchronous.

  • get_current_value(tag_name: str): Fetch the current value for a given PI tag.
  • get_recorded_values(tag_name: str, start_time: str, end_time: str): Fetch historical (recorded) values for a time range.
  • write_value(tag_name: str, value: Any, timestamp: Any = None): Write a value for a PI tag.
  • search_tags(query: str): Search for PI tags based on a query pattern.
  • get_asset_servers(): List available PI AF System (Asset Server) names.
  • get_organizations(asset_server: str): List AF Databases (Organizations) on a specific Asset Server.
  • test_connection(): Verify the connection status to the PI Web API.
  • close(): Close the underlying HTTP client.

Passing credentials directly

from piwebapiconnect import get_service

service = get_service(
    url="https://your-pi-server/piwebapi",
    username="domain\\user",
    password="your-password",
    server_name="PISERVER01",
    verify_ssl=False  # Optional
)

async def main():
    val = await service.get_current_value("YourTagName")
    print(val)

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

piwebapiconnect-0.1.1.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

piwebapiconnect-0.1.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file piwebapiconnect-0.1.1.tar.gz.

File metadata

  • Download URL: piwebapiconnect-0.1.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.6

File hashes

Hashes for piwebapiconnect-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d43a0b56ce59c8f6c5e67c814f20c2e694a48c6eeab13238b0b287d86af430cd
MD5 935714458e71503ef2f760362a1b567f
BLAKE2b-256 41cfca91813b0c9d812cd77011b7af27bb091f065c50612e6a14cea934b1bb65

See more details on using hashes here.

File details

Details for the file piwebapiconnect-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for piwebapiconnect-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 df541d9d3866a0731770b4f976333b8f3f159285e1b8593747d172cf465fcee6
MD5 0c1ee278e9408a7481bae7361a67315f
BLAKE2b-256 4ccf9f7de666e8dac984c4644975a53a97ffbd7c3d2ba6bf72acac6b4602b0de

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