PI Web API and Python
The OsiSoft PI has an html based application system called PIWebAPI to extract data. There are a couple of steps to follow to set up the system, which I will cover in my posts later, but for now, let's see how we can access the data. We will search for all tags in our database called "DTBASE" and show the results. Assumptions: IP address: 192.168.1.44 Username to piwebapi: username Password to piwebapi: password import base64 import requests from django.shortcuts import render, redirect First we need to create the query url. We can use api url creator programs such as Postman . It is much easier to check if API is actually working. url = "https://192.168.1.44/piwebapi/search/query?q=* Then we will create the header string for html before browsing it using GET. usrPass = username + ":" + password b64Val = base64.b64encode(usrPass.encode()).decode("ascii") payload = "" headers = { "Authorization": &