Skip to content

pidevguru/PI-Web-API-Client-Python

Repository files navigation

PI Web API client for Python

Overview

This repository has the source code package of the PI Web API client for Python. PI Web API 2018 swagger specification was used to create this package.

Requirements

  • PI Web API 2018+ instance available on your domain or a public network.

Installation

pip install

If the python package is hosted on Github, you can install directly from Github

pip install pidevguru.piwebapi

Setuptools

Install via Setuptools.

python setup.py install --user

Documentation

All PI Web API server methods are mapped on this client. Please refer to PI Web API help page.

Examples

Create an instance of the PI Web API top level object.

    from pidevguru.piwebapi.pi_web_api_client import PIWebApiClient
    piwebapi = PIWebApiClient("https://webserver/piwebapi", verifySsl=True) 
    piwebapi.set_basic_auth("username", "password")	

Kerberos Authentication

    from pidevguru.piwebapi.pi_web_api_client import PIWebApiClient
    piwebapi = PIWebApiClient("https://webserver/piwebapi", verifySsl=False)  
	piwebapi.set_kerberos_auth()	

Get the PI Data Archive WebId

    dataServer = piwebapi.dataServer.get_by_path("\\\\PISRV1");

Create a new PI Point

    newPoint = PIPoint()
    newPoint.name  = "SINUSOID_TEST"
    newPoint.descriptor = "Test PI Point for Python PI Web API Client"
    newPoint.point_class = "classic"
    newPoint.point_type = "float32"
    newPoint.future = False
    res = piwebapi.dataServer.create_point_with_http_info(dataServer.web_id, newPoint);         

Get PI Points WebIds

    point1 = piwebapi.point.get_by_path("\\\\PISRV1\\sinusoid");

Licensing

Copyright 2023 PIDevGuru.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Please see the file named LICENSE.md.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages