Skip to content

Commit 06f7e9b

Browse files
author
Marcos Vainer Loeff
committed
Upgrade to 2017 R2
1 parent 869d0a2 commit 06f7e9b

File tree

347 files changed

+11070
-2273
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

347 files changed

+11070
-2273
lines changed

.idea/PI-Web-API-Client-Python.iml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/workspace.xml

Lines changed: 713 additions & 191 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

DOCUMENTATION.md

Lines changed: 54 additions & 8 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
PI Web API Client libraries for Python
1+
PI Web API client library for Python (2017 R2)
22
===
33

44
## Overview
5-
This repository has the source code package of the PI Web API Client libraries for Python.
5+
This repository has the source code package of the PI Web API client libraries for Python. This version was developed on top of the PI Web API 2017 R2 swagger specification.
66

77
## Requirements.
88

9-
Python 2.7 and 3.4+
10-
9+
- PI Web API 2017 R2 installed within your domain using Kerberos or Basic Authentication. If you are using an older version, some methods might not work.
10+
- Python 2.7 and 3.4+
1111

1212
## Installation
1313
### pip install
@@ -44,6 +44,10 @@ This library was tested using PyCharm 2017.1.5 and Anaconda3 5.0.0
4444

4545
All classes and methods are described on the [DOCUMENTATION](DOCUMENTATION.md).
4646

47+
## Notes
48+
49+
- Is is highly recommended to turn debug mode on in case you are using PI Web API 2017 R2+ in order to receive more detailed exception errors. This can be achieved by creating or editing the DebugMode attribute's value to TRUE from the System Configuration element.
50+
- The X-Requested-With header is added to work with CSRF defences.
4751

4852
## Examples
4953

@@ -64,16 +68,16 @@ Only Basic Authentication is available in this version. Therefore, the variable
6468

6569

6670
```python
67-
df1 = client.data.get_recorded_values("pi:\\\\JUPITER001\\cdt158", None, None, "*-9d", None, None, None, None, "*-10d", None)df4 = client.data.get_multiple_recorded_values(["pi:\\JUPITER001\sinusoid", "pi:\\JUPITER001\sinusoidu", "pi:\\JUPITER001\cdt158"],None, "*", None, None, None, None, "*-1d", None)
68-
df2 = client.data.get_interpolated_values("pi:\\JUPITER001\\sinusoidu",None, "*", None, None, "2h", None, "*-1d", None)
69-
df3 = client.data.get_plot_values("pi:\\\\JUPITER001\\sinusoidu", None, "*", 10, None, "*-3d", None)
70-
df4 = client.data.get_recorded_values("pi:\\\\PISRV1\\sinusoid", None, None, "*", None, None, None, "items.value;items.timestamp", "*-1d", None)
71-
df5 = client.data.get_recorded_values("pi:\\\\PISRV1\\sinusoid", None, None, "*", None, None, None, "items.good;items.questionable;items.substituted", "*-1d", None)
72-
dfs1 = client.data.get_multiple_recorded_values(["pi:\\\\JUPITER001\\sinusoid", "pi:\\\\JUPITER001\\sinusoidu", "pi:\\\\JUPITER001\\cdt158", "af:\\\\JUPITER001\\Vitens\\Vitens\\Friesland province\\01 Production sites\\Production Site Noordbergum\\Distribution\\Quality|pH"],None, "*", None, None, None, None, "*-1d", None)
73-
dfs2 = client.data.get_multiple_interpolated_values(["pi:\\\\JUPITER001\\sinusoid", "pi:\\\\JUPITER001\\sinusoidu", "pi:\\\\JUPITER001\\cdt158", "af:\\\\JUPITER001\\Vitens\\Vitens\\Friesland province\\01 Production sites\\Production Site Noordbergum\\Distribution\\Quality|pH"], "*", None, None, "1d", None, "*-5d", None)
74-
dfs3 = client.data.get_multiple_plot_values(["pi:\\\\JUPITER001\\sinusoid", "pi:\\\\JUPITER001\\sinusoidu", "pi:\\\\JUPITER001\\cdt158", "af:\\\\JUPITER001\\Vitens\\Vitens\\Friesland province\\01 Production sites\\Production Site Noordbergum\\Distribution\\Quality|pH"], "*", 10, None, "*-1d", None)
75-
dfs4 = client.data.get_multiple_recorded_values(paths, None, "*", None, None, None, "items.items.value;items.items.timestamp", "*-1d", None)
76-
dfs5 = client.data.get_multiple_interpolated_values(paths, "*", None, None, "1h", "items.items.value;items.items.timestamp", "*-5d", None)
71+
df1 = client.data.get_recorded_values("pi:\\\\PISRV1\\sinusoid",None, None, "*", None, None, None, None, "*-1d", None)
72+
df2 = client.data.get_interpolated_values("pi:\\PISRV1\\sinusoid", None, "*", None, None, "1h", None, "*-1d", None, None, None)
73+
df3 = client.data.get_plot_values("pi:\\\\PISRV1\\sinusoid", None, "*", 15, None, "*-1d", None)
74+
df4 = client.data.get_recorded_values("pi:\\\\PISRV1\\sinusoid", None, None, "*", None, None, None, "items.value;items.timestamp", "*-1d", None)
75+
76+
paths = ["pi:\\\\PISRV1\\sinusoid", "pi:\\\\PISRV1\\sinusoidu", "pi:\\\\PISRV1\\cdt158"];
77+
dfs1 = client.data.get_multiple_recorded_values(paths, None, "*", None, None, None, None, None, None, "*-1d", None, None)
78+
dfs2 = client.data.get_multiple_interpolated_values(paths, "*", None, None, "1d", None, None, None, "*-5d", None, None, None, None)
79+
dfs3 = client.data.get_multiple_plot_values(paths, "*", 10, None, None, None, "*-1d", None, None)
80+
dfs4 = client.data.get_multiple_recorded_values(paths, None, "*", None, None, None, "items.items.value;items.items.timestamp", None, None, "*-1d", None, None)
7781
```
7882

7983
The path from the methods above should start with "pi:" (if your stream is a PI Point) or "af:" (if your stream is an AF attribute).
@@ -84,7 +88,7 @@ The path from the methods above should start with "pi:" (if your stream is a PI
8488
### Get the PI Data Archive WebId
8589

8690
```python
87-
dataServer = client.dataServer.get_by_path("\\\\JUPITER001", None);
91+
dataServer = client.dataServer.get_by_path("\\\\PISRV1", None, None);
8892
```
8993

9094
### Create a new PI Point
@@ -96,15 +100,15 @@ The path from the methods above should start with "pi:" (if your stream is a PI
96100
newPoint.point_class = "classic"
97101
newPoint.point_type = "float32"
98102
newPoint.future = False
99-
res = client.dataServer.create_point_with_http_info(dataServer.web_id, newPoint);
103+
res = client.dataServer.create_point_with_http_info(dataServer.web_id, newPoint, None);
100104
```
101105

102106
### Get PI Points WebIds
103107

104108
```python
105-
point1 = client.point.get_by_path("\\\\JUPITER001\\sinusoid", None)
106-
point2 = client.point.get_by_path("\\\\JUPITER001\\cdt158", None)
107-
point3 = client.point.get_by_path("\\\\JUPITER001\\sinusoidu", None)
109+
point1 = client.point.get_by_path("\\\\PISRV1\\sinusoid", None, None);
110+
point2 = client.point.get_by_path("\\\\PISRV1\\cdt158", None, None);
111+
point3 = client.point.get_by_path("\\\\PISRV1\\sinusoidu", None, None);
108112
```
109113

110114
### Get recorded values in bulk using the StreamSet/GetRecordedAdHoc
@@ -114,7 +118,7 @@ The path from the methods above should start with "pi:" (if your stream is a PI
114118
webIds.append(point1.web_id);
115119
webIds.append(point2.web_id);
116120
webIds.append(point3.web_id);
117-
piItemsStreamValues = client.streamSet.get_recorded_ad_hoc(webIds, None, "*", None, True, 1000, None, "*-3d", None);
121+
piItemsStreamValues = client.streamSet.get_recorded_ad_hoc(webIds, None, "*", None, True, 1000, None, None, None, "*-3d", None, None);
118122

119123
```
120124

@@ -176,8 +180,8 @@ The path from the methods above should start with "pi:" (if your stream is a PI
176180
### Get an element and an attribute by path
177181

178182
```python
179-
element = client.element.get_by_path("\\\\JUPITER001\\Universities\\UC Davis", None)
180-
attribute = client.attribute.get_by_path("\\\\JUPITER001\\Universities\\UC Davis\\Buildings|Campus Average EUI", "Name")
183+
element = client.element.get_by_path("\\\\PISRV1\\City Bikes\\(TO)BIKE", None, None)
184+
attribute = client.attribute.get_by_path("\\\\PISRV1\\City Bikes\\(TO)BIKE\\01. Certosa P.le Avis|Empty Slots", "Name", None)
181185

182186
```
183187

@@ -186,7 +190,7 @@ The path from the methods above should start with "pi:" (if your stream is a PI
186190

187191

188192
## Licensing
189-
Copyright 2017 OSIsoft, LLC.
193+
Copyright 2018 OSIsoft, LLC.
190194

191195
Licensed under the Apache License, Version 2.0 (the "License");
192196
you may not use this file except in compliance with the License.

docs/api/AnalysisApi.md

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ Method | HTTP request | Description
1313
[**get_security_entry_by_name**](AnalysisApi.md#getsecurityentrybyname) | **GET** /analyses/{webId}/securityentries/{name} | Retrieve the security entry associated with the analysis with the specified name.
1414
[**update_security_entry**](AnalysisApi.md#updatesecurityentry) | **PUT** /analyses/{webId}/securityentries/{name} | Update a security entry owned by the analysis.
1515
[**delete_security_entry**](AnalysisApi.md#deletesecurityentry) | **DELETE** /analyses/{webId}/securityentries/{name} | Delete a security entry owned by the analysis.
16+
[**get_analyses_query**](AnalysisApi.md#getanalysesquery) | **GET** /analyses/search | Retrieve analyses based on the specified conditions. By default, returns all analyses.
1617

1718

1819
# **get_by_path**
19-
> get_by_path('path', 'selected_fields')
20+
> get_by_path('path', 'selected_fields', 'web_id_type')
2021
2122
Retrieve an Analysis by path.
2223

@@ -26,6 +27,7 @@ Name | Type | Description | Notes
2627
------------- | ------------- | ------------- | -------------
2728
**path** | **str**| The path to the Analysis.. | [required]
2829
**selected_fields** | **str**| List of fields to be returned in the response, separated by semicolons (;). If this parameter is not specified, all available fields will be returned.. | [optional]
30+
**web_id_type** | **str**| Optional parameter. Used to specify the type of WebID. Useful for URL brevity and other special cases. Default is the value of the configuration item "WebIDType".. | [optional]
2931

3032

3133
### Return type
@@ -35,7 +37,7 @@ Name | Type | Description | Notes
3537
[[Back to top]](#) [[Back to API list]](../../DOCUMENTATION.md#documentation-for-api-endpoints) [[Back to Model list]](../../DOCUMENTATION.md#documentation-for-models) [[Back to DOCUMENTATION]](../../DOCUMENTATION.md)
3638

3739
# **get**
38-
> get('web_id', 'selected_fields')
40+
> get('web_id', 'selected_fields', 'web_id_type')
3941
4042
Retrieve an Analysis.
4143

@@ -45,6 +47,7 @@ Name | Type | Description | Notes
4547
------------- | ------------- | ------------- | -------------
4648
**web_id** | **str**| The ID of the Analysis.. | [required]
4749
**selected_fields** | **str**| List of fields to be returned in the response, separated by semicolons (;). If this parameter is not specified, all available fields will be returned.. | [optional]
50+
**web_id_type** | **str**| Optional parameter. Used to specify the type of WebID. Useful for URL brevity and other special cases. Default is the value of the configuration item "WebIDType".. | [optional]
4851

4952

5053
### Return type
@@ -91,7 +94,7 @@ None
9194
[[Back to top]](#) [[Back to API list]](../../DOCUMENTATION.md#documentation-for-api-endpoints) [[Back to Model list]](../../DOCUMENTATION.md#documentation-for-models) [[Back to DOCUMENTATION]](../../DOCUMENTATION.md)
9295

9396
# **get_categories**
94-
> get_categories('web_id', 'selected_fields')
97+
> get_categories('web_id', 'selected_fields', 'web_id_type')
9598
9699
Get an Analysis' categories.
97100

@@ -101,6 +104,7 @@ Name | Type | Description | Notes
101104
------------- | ------------- | ------------- | -------------
102105
**web_id** | **str**| The ID of the Analysis.. | [required]
103106
**selected_fields** | **str**| List of fields to be returned in the response, separated by semicolons (;). If this parameter is not specified, all available fields will be returned.. | [optional]
107+
**web_id_type** | **str**| Optional parameter. Used to specify the type of WebID. Useful for URL brevity and other special cases. Default is the value of the configuration item "WebIDType".. | [optional]
104108

105109

106110
### Return type
@@ -110,7 +114,7 @@ Name | Type | Description | Notes
110114
[[Back to top]](#) [[Back to API list]](../../DOCUMENTATION.md#documentation-for-api-endpoints) [[Back to Model list]](../../DOCUMENTATION.md#documentation-for-models) [[Back to DOCUMENTATION]](../../DOCUMENTATION.md)
111115

112116
# **get_security**
113-
> get_security('web_id', 'user_identity', 'force_refresh', 'selected_fields')
117+
> get_security('web_id', 'user_identity', 'force_refresh', 'selected_fields', 'web_id_type')
114118
115119
Get the security information of the specified security item associated with the Analysis for a specified user.
116120

@@ -122,6 +126,7 @@ Name | Type | Description | Notes
122126
**user_identity** | **list[str]**| The user identity for the security information to be checked. Multiple security identities may be specified with multiple instances of the parameter. If the parameter is not specified, only the current user's security rights will be returned.. | [required]
123127
**force_refresh** | **bool**| Indicates if the security cache should be refreshed before getting security information. The default is 'false'.. | [optional]
124128
**selected_fields** | **str**| List of fields to be returned in the response, separated by semicolons (;). If this parameter is not specified, all available fields will be returned.. | [optional]
129+
**web_id_type** | **str**| Optional parameter. Used to specify the type of WebID. Useful for URL brevity and other special cases. Default is the value of the configuration item "WebIDType".. | [optional]
125130

126131

127132
### Return type
@@ -131,7 +136,7 @@ Name | Type | Description | Notes
131136
[[Back to top]](#) [[Back to API list]](../../DOCUMENTATION.md#documentation-for-api-endpoints) [[Back to Model list]](../../DOCUMENTATION.md#documentation-for-models) [[Back to DOCUMENTATION]](../../DOCUMENTATION.md)
132137

133138
# **get_security_entries**
134-
> get_security_entries('web_id', 'name_filter', 'selected_fields')
139+
> get_security_entries('web_id', 'name_filter', 'selected_fields', 'web_id_type')
135140
136141
Retrieve the security entries associated with the analysis based on the specified criteria. By default, all security entries for this analysis are returned.
137142

@@ -142,6 +147,7 @@ Name | Type | Description | Notes
142147
**web_id** | **str**| The ID of the analysis.. | [required]
143148
**name_filter** | **str**| The name query string used for filtering security entries. The default is no filter.. | [optional]
144149
**selected_fields** | **str**| List of fields to be returned in the response, separated by semicolons (;). If this parameter is not specified, all available fields will be returned.. | [optional]
150+
**web_id_type** | **str**| Optional parameter. Used to specify the type of WebID. Useful for URL brevity and other special cases. Default is the value of the configuration item "WebIDType".. | [optional]
145151

146152

147153
### Return type
@@ -151,7 +157,7 @@ Name | Type | Description | Notes
151157
[[Back to top]](#) [[Back to API list]](../../DOCUMENTATION.md#documentation-for-api-endpoints) [[Back to Model list]](../../DOCUMENTATION.md#documentation-for-models) [[Back to DOCUMENTATION]](../../DOCUMENTATION.md)
152158

153159
# **create_security_entry**
154-
> create_security_entry('web_id', 'security_entry', 'apply_to_children')
160+
> create_security_entry('web_id', 'security_entry', 'apply_to_children', 'web_id_type')
155161
156162
Create a security entry owned by the analysis.
157163

@@ -162,6 +168,7 @@ Name | Type | Description | Notes
162168
**web_id** | **str**| The ID of the analysis, where the security entry will be created.. | [required]
163169
**security_entry** | **PISecurityEntry**| The new security entry definition. The full list of allow and deny rights must be supplied.. | [required]
164170
**apply_to_children** | **bool**| If false, the new access permissions are only applied to the associated object. If true, the access permissions of children with any parent-child reference types will change when the permissions on the primary parent change.. | [optional]
171+
**web_id_type** | **str**| Optional parameter. Used to specify the type of WebID. Useful for URL brevity and other special cases. Default is the value of the configuration item "WebIDType".. | [optional]
165172

166173

167174
### Return type
@@ -171,7 +178,7 @@ None
171178
[[Back to top]](#) [[Back to API list]](../../DOCUMENTATION.md#documentation-for-api-endpoints) [[Back to Model list]](../../DOCUMENTATION.md#documentation-for-models) [[Back to DOCUMENTATION]](../../DOCUMENTATION.md)
172179

173180
# **get_security_entry_by_name**
174-
> get_security_entry_by_name('name', 'web_id', 'selected_fields')
181+
> get_security_entry_by_name('name', 'web_id', 'selected_fields', 'web_id_type')
175182
176183
Retrieve the security entry associated with the analysis with the specified name.
177184

@@ -182,6 +189,7 @@ Name | Type | Description | Notes
182189
**name** | **str**| The name of the security entry. For every backslash character (\) in the security entry name, replace with asterisk (*). As an example, use domain*username instead of domain\username.. | [required]
183190
**web_id** | **str**| The ID of the analysis.. | [required]
184191
**selected_fields** | **str**| List of fields to be returned in the response, separated by semicolons (;). If this parameter is not specified, all available fields will be returned.. | [optional]
192+
**web_id_type** | **str**| Optional parameter. Used to specify the type of WebID. Useful for URL brevity and other special cases. Default is the value of the configuration item "WebIDType".. | [optional]
185193

186194

187195
### Return type
@@ -230,3 +238,26 @@ Name | Type | Description | Notes
230238
None
231239

232240
[[Back to top]](#) [[Back to API list]](../../DOCUMENTATION.md#documentation-for-api-endpoints) [[Back to Model list]](../../DOCUMENTATION.md#documentation-for-models) [[Back to DOCUMENTATION]](../../DOCUMENTATION.md)
241+
242+
# **get_analyses_query**
243+
> get_analyses_query('database_web_id', 'max_count', 'query', 'selected_fields', 'start_index', 'web_id_type')
244+
245+
Retrieve analyses based on the specified conditions. By default, returns all analyses.
246+
247+
### Parameters
248+
249+
Name | Type | Description | Notes
250+
------------- | ------------- | ------------- | -------------
251+
**database_web_id** | **str**| The ID of the asset database to use as the root of the query.. | [optional]
252+
**max_count** | **int**| The maximum number of objects to be returned per call (page size). The default is 1000.. | [optional]
253+
**query** | **str**| The query string is a list of filters used to perform an AFSearch for the analyses in the asset database. An example would be: "query= Name:=MyAnalysis1* Template:=AnalysisTemplate*".. | [optional]
254+
**selected_fields** | **str**| List of fields to be returned in the response, separated by semicolons (;). If this parameter is not specified, all available fields will be returned.. | [optional]
255+
**start_index** | **int**| The starting index (zero based) of the items to be returned. The default is 0.. | [optional]
256+
**web_id_type** | **str**| Optional parameter. Used to specify the type of WebID. Useful for URL brevity and other special cases. Default is the value of the configuration item "WebIDType".. | [optional]
257+
258+
259+
### Return type
260+
261+
[**PIItemsAnalysis**](../models/PIItemsAnalysis.md)
262+
263+
[[Back to top]](#) [[Back to API list]](../../DOCUMENTATION.md#documentation-for-api-endpoints) [[Back to Model list]](../../DOCUMENTATION.md#documentation-for-models) [[Back to DOCUMENTATION]](../../DOCUMENTATION.md)

0 commit comments

Comments
 (0)