epmwebapi 5.0.45__tar.gz → 6.0.40__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/PKG-INFO +1 -1
- epmwebapi-6.0.40/epmwebapi/_version.py +1 -0
- epmwebapi-6.0.40/epmwebapi/autostarttimer.py +26 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/datavaluejson.py +28 -3
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/epmconnection.py +32 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/epmmodelobject.py +18 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/epmutils.py +1 -1
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/epmvariable.py +0 -1
- epmwebapi-6.0.40/epmwebapi/exporttype.py +15 -0
- epmwebapi-6.0.40/epmwebapi/report.py +29 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/resourcesmanager.py +88 -1
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi.egg-info/PKG-INFO +1 -1
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi.egg-info/SOURCES.txt +2 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/setup.py +1 -1
- epmwebapi-5.0.45/epmwebapi/_version.py +0 -1
- epmwebapi-5.0.45/epmwebapi/autostarttimer.py +0 -19
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/LICENSE.txt +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/Readme.md +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/__init__.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/aggregatedetails.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/annotationvaluejson.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/authorizationservice.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/basicvariable.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/basicvariablepropertymask.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/browsedirection.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/browseitemmodeljson.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/browsemodeljson.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/browseresultitemmodeljson.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/browseresultmodeljson.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/customtypedefinition.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/dataobjectattributes.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/dataobjectsfilter.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/datasetconfig.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/datasetpen.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/diagnosticmodeljson.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/dll_references/Elipse.Epm.AddressSpaceModel.dll +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/dll_references/ElipseLoggerInterface.dll +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/dll_references/EpmData.dll +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/dll_references/Microsoft.Extensions.Logging.Abstractions.dll +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/domainfilter.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/downloadtype.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/epmconnectioncontext.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/epmdataobject.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/epmnodeids.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/epmobject.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/epmproperty.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/epmsession.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/epmwebapi.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/folder.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/historyprocessedmodeljson.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/historyrawmodeljson.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/historyresultitemmodeljson.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/historyresultmodeljson.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/historyupdatedataitemmodeljson.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/historyupdatedatamodeljson.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/historyupdateresultmodeljson.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/historyupdatetype.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/itempathandcontinuationpointjson.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/itempathjson.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/mimetype.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/nodeattributes.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/nodeclassmask.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/numpyextras.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/performupdatetype.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/portalresources.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/processorresources.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/querymodeljson.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/queryperiod.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/queryresultitemmodeljson.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/queryresultmask.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/queryresultmodeljson.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/readitemmodeljson.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/readmodeljson.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/readresultitemmodeljson.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/readresultmodeljson.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/resource.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/statuscodes.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/writeitemmodeljson.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/writemodeljson.py +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi.egg-info/dependency_links.txt +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi.egg-info/requires.txt +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi.egg-info/top_level.txt +0 -0
- {epmwebapi-5.0.45 → epmwebapi-6.0.40}/setup.cfg +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '6.0.40'
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from threading import Timer, Thread, Event
|
|
2
|
+
|
|
3
|
+
class AutoStartTimer(object):
|
|
4
|
+
def __init__(self, spam, callback):
|
|
5
|
+
self._spam = spam
|
|
6
|
+
self._callback = callback
|
|
7
|
+
self._stopEvent = Event()
|
|
8
|
+
self._thread = Thread(target=self._periodicalExecution)
|
|
9
|
+
self._thread.daemon = True
|
|
10
|
+
self._thread.start()
|
|
11
|
+
|
|
12
|
+
def _periodicalExecution(self):
|
|
13
|
+
while not self._stopEvent.is_set():
|
|
14
|
+
if not self._stopEvent.wait(self._spam):
|
|
15
|
+
self._callback()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def start(self):
|
|
19
|
+
self.cancel()
|
|
20
|
+
self._thread = Thread(target=self._periodicalExecution)
|
|
21
|
+
self._thread.daemon = True
|
|
22
|
+
self._thread.start()
|
|
23
|
+
|
|
24
|
+
def cancel(self):
|
|
25
|
+
self._stopEvent.set()
|
|
26
|
+
self._thread.join()
|
|
@@ -8,7 +8,7 @@ class DataValueJSON(object):
|
|
|
8
8
|
"""
|
|
9
9
|
Class representing a DataValue.
|
|
10
10
|
"""
|
|
11
|
-
def __init__(self, value, statusCode, timestamp, dataTypeId=None):
|
|
11
|
+
def __init__(self, value, statusCode, timestamp, serverTimestamp = None, dataTypeId=None):
|
|
12
12
|
"""
|
|
13
13
|
Creates a new DataValue.
|
|
14
14
|
|
|
@@ -18,11 +18,14 @@ class DataValueJSON(object):
|
|
|
18
18
|
:type statusCode: int
|
|
19
19
|
:param timestamp: Timestamp of this DataValue.
|
|
20
20
|
:type timestamp: datetime.datetime
|
|
21
|
+
:param serverTimestamp: ServerTimestamp of this DataValue.
|
|
22
|
+
:type serverTimestamp: datetime.datetime
|
|
21
23
|
:param dataTypeId: ID of data type. Default is None.
|
|
22
24
|
:type dataTypeId: object
|
|
23
25
|
"""
|
|
24
26
|
self._value = value
|
|
25
27
|
self._statusCode = statusCode
|
|
28
|
+
|
|
26
29
|
if type(timestamp) == str:
|
|
27
30
|
try:
|
|
28
31
|
self._timestamp = dateutil.parser.parse(timestamp).astimezone(timezone.utc)
|
|
@@ -30,6 +33,15 @@ class DataValueJSON(object):
|
|
|
30
33
|
self._timestamp = datetime.datetime(1,1,1,0,0,tzinfo=datetime.timezone.utc)
|
|
31
34
|
else:
|
|
32
35
|
self._timestamp = timestamp
|
|
36
|
+
|
|
37
|
+
if type(serverTimestamp) == str:
|
|
38
|
+
try:
|
|
39
|
+
self._serverTimestamp = dateutil.parser.parse(serverTimestamp).astimezone(timezone.utc)
|
|
40
|
+
except OverflowError as error:
|
|
41
|
+
self._serverTimestamp = datetime.datetime(1,1,1,0,0,tzinfo=datetime.timezone.utc)
|
|
42
|
+
else:
|
|
43
|
+
self._serverTimestamp = serverTimestamp
|
|
44
|
+
|
|
33
45
|
self._dataTypeId = dataTypeId
|
|
34
46
|
|
|
35
47
|
@property
|
|
@@ -62,6 +74,16 @@ class DataValueJSON(object):
|
|
|
62
74
|
"""
|
|
63
75
|
return self._timestamp
|
|
64
76
|
|
|
77
|
+
@property
|
|
78
|
+
def serverTimestamp(self) -> datetime.datetime:
|
|
79
|
+
"""
|
|
80
|
+
Returns the server timestamp from this DataValue.
|
|
81
|
+
|
|
82
|
+
:return: A `datetime.datetime` value representing a source timestamp.
|
|
83
|
+
:rtype: datetime.datetime
|
|
84
|
+
"""
|
|
85
|
+
return self._serverTimestamp
|
|
86
|
+
|
|
65
87
|
def toDict(self):
|
|
66
88
|
"""
|
|
67
89
|
Returns this `DataValueJSON` object as a dictionary.
|
|
@@ -72,7 +94,10 @@ class DataValueJSON(object):
|
|
|
72
94
|
value = self._value.isoformat() if type(self._value) == datetime.datetime else self._value
|
|
73
95
|
if self._dataTypeId is None:
|
|
74
96
|
return {'value': value, 'quality': self._statusCode,
|
|
75
|
-
'timestamp' : self._timestamp.isoformat()
|
|
97
|
+
'timestamp' : self._timestamp.isoformat(),
|
|
98
|
+
'serverTimestamp' : self._serverTimestamp.isoformat() if self._serverTimestamp != None else None}
|
|
76
99
|
else:
|
|
77
100
|
return {'value': value, 'quality': self._statusCode,
|
|
78
|
-
'timestamp': self._timestamp.isoformat(),
|
|
101
|
+
'timestamp': self._timestamp.isoformat(),
|
|
102
|
+
'serverTimestamp' : self._serverTimestamp.isoformat() if self._serverTimestamp != None else None,
|
|
103
|
+
'dataTypeId': self._dataTypeId}
|
|
@@ -1064,6 +1064,37 @@ class EpmConnection(object):
|
|
|
1064
1064
|
|
|
1065
1065
|
return objs
|
|
1066
1066
|
|
|
1067
|
+
def _addReferencesEpmModel(self, path, obj):
|
|
1068
|
+
url = self._webApi + '/epm/v1/epmmodel/reference/' + path
|
|
1069
|
+
paths = []
|
|
1070
|
+
objs = {}
|
|
1071
|
+
|
|
1072
|
+
if type(obj) is not EpmObject and type(obj) is not EpmModelObject:
|
|
1073
|
+
raise BadArgumentException("obj must be an EpmObject type!")
|
|
1074
|
+
jsonRequest = {'itemPath': obj._itemPath.toDict()}
|
|
1075
|
+
|
|
1076
|
+
session = self._authorizationService.getEpmSession()
|
|
1077
|
+
response = session.post(url, json=jsonRequest, verify=False)
|
|
1078
|
+
|
|
1079
|
+
if response.status_code == 200:
|
|
1080
|
+
responseCode = response.json()['code']
|
|
1081
|
+
if responseCode != 0:
|
|
1082
|
+
if responseCode == 2153840640:
|
|
1083
|
+
raise InstanceNameDuplicatedException('Reference name duplicated')
|
|
1084
|
+
elif responseCode == 2154758144:
|
|
1085
|
+
raise InvalidObjectNameException('EPM Model object not found')
|
|
1086
|
+
elif responseCode == 2153512960:
|
|
1087
|
+
raise ObjectDependenciesException('Instance type creation not allowed')
|
|
1088
|
+
elif responseCode == 2158690304:
|
|
1089
|
+
raise InvalidObjectTypeException('Invalid type name')
|
|
1090
|
+
else:
|
|
1091
|
+
raise Exception(response.json()['message'])
|
|
1092
|
+
else:
|
|
1093
|
+
raise Exception("AddReferenceEpmModel call error + '" + str(response.status_code) + "'. Reason: " +
|
|
1094
|
+
response.reason + ". Text: " + response.text)
|
|
1095
|
+
|
|
1096
|
+
return True
|
|
1097
|
+
|
|
1067
1098
|
def _removeInstanceEpmModel(self, path):
|
|
1068
1099
|
url = self._webApi + '/epm/v1/epmmodel/' + path
|
|
1069
1100
|
|
|
@@ -1838,6 +1869,7 @@ class EpmConnection(object):
|
|
|
1838
1869
|
readItem = ReadResultItemModelJSON(item['identity'],
|
|
1839
1870
|
DataValueJSON(item['value']['value'], item['value']['quality'],
|
|
1840
1871
|
item['value']['timestamp'],
|
|
1872
|
+
item['value']['serverTimestamp'] if 'serverTimestamp' in item['value'] else None,
|
|
1841
1873
|
item['value']['dataTypeId'] if 'dataTypeId' in item['value'] else None))
|
|
1842
1874
|
else:
|
|
1843
1875
|
readItem = None
|
|
@@ -60,6 +60,24 @@ class EpmModelObject(EpmObject):
|
|
|
60
60
|
|
|
61
61
|
return self._epmConnection._addInstancesEpmModel(addPath, names, objTypes)
|
|
62
62
|
|
|
63
|
+
def addReference(self, obj:EpmObject) -> bool:
|
|
64
|
+
"""
|
|
65
|
+
Adds object reference to the current object.
|
|
66
|
+
|
|
67
|
+
:param obj: The object to be referenced.
|
|
68
|
+
:type obj: EpmObject
|
|
69
|
+
:return: True / False depending of the operation result.
|
|
70
|
+
:rtype: bool
|
|
71
|
+
"""
|
|
72
|
+
splitPath = self._path.split("/")
|
|
73
|
+
|
|
74
|
+
if splitPath[0] == "":
|
|
75
|
+
addPath = "/".join(splitPath[3:])
|
|
76
|
+
else:
|
|
77
|
+
addPath = "/".join(splitPath[2:])
|
|
78
|
+
|
|
79
|
+
return self._epmConnection._addReferencesEpmModel(addPath, obj)
|
|
80
|
+
|
|
63
81
|
def removeInstance(self, name:str):
|
|
64
82
|
"""
|
|
65
83
|
Removes a child object from this object.
|
|
@@ -10,7 +10,7 @@ class EpmUtils:
|
|
|
10
10
|
if isinstance(dataValuesCopy, DataValueJSON):
|
|
11
11
|
statusCode = dataValuesCopy.statusCode
|
|
12
12
|
opcUa = EpmUtils._statusCodeToOpcUa(statusCode)
|
|
13
|
-
dataValue = DataValueJSON(dataValuesCopy.value, opcUa, dataValuesCopy.timestamp)
|
|
13
|
+
dataValue = DataValueJSON(dataValuesCopy.value, opcUa, dataValuesCopy.timestamp, dataValuesCopy.serverTimestamp)
|
|
14
14
|
return dataValue
|
|
15
15
|
elif isinstance(dataValuesCopy, dict):
|
|
16
16
|
for numpyArray in dataValuesCopy.values():
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
|
|
3
|
+
class ExportType(Enum):
|
|
4
|
+
"""
|
|
5
|
+
An enumeration with all types of Export Type.
|
|
6
|
+
"""
|
|
7
|
+
Excel2003 = "Excel2003"
|
|
8
|
+
Excel = "Excel"
|
|
9
|
+
Word = "Word"
|
|
10
|
+
Pdf = "Pdf"
|
|
11
|
+
Csv = "Csv"
|
|
12
|
+
Json = "Json"
|
|
13
|
+
Xml = "Xml"
|
|
14
|
+
Tiff = "Tiff"
|
|
15
|
+
Mht = "Mht"
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
import json
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
from typing import Dict, Any
|
|
6
|
+
from .resource import Resource
|
|
7
|
+
from .mimetype import Application
|
|
8
|
+
from .exporttype import ExportType
|
|
9
|
+
|
|
10
|
+
class Report(Resource):
|
|
11
|
+
"""
|
|
12
|
+
Class representing a Report (rdlx file) from **EPM Portal**'s or **EPM Processor**'s Resource Manager.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def __init__(self, resourcesManager, id, name, description):
|
|
16
|
+
super().__init__(resourcesManager, id, name, description, Application.OctetStream.value)
|
|
17
|
+
|
|
18
|
+
def export(self, type:ExportType, params:Dict[str, Any]) -> any:
|
|
19
|
+
"""
|
|
20
|
+
Exports a Report from Resources Manager to the specified type.
|
|
21
|
+
|
|
22
|
+
:param type: Type of Exportation. Possible values are `epmwebapi.downloadtype.ExportType.Excel2003`, `epmwebapi.downloadtype.ExportType.Excel`,
|
|
23
|
+
`epmwebapi.downloadtype.ExportType.Word`, `epmwebapi.downloadtype.ExportType.Pdf`, `epmwebapi.downloadtype.ExportType.Csv`, `epmwebapi.downloadtype.ExportType.Json`,
|
|
24
|
+
`epmwebapi.downloadtype.ExportType.Xml`, `epmwebapi.downloadtype.ExportType.Tiff`, `epmwebapi.downloadtype.ExportType.Mht`.
|
|
25
|
+
:type type: epmwebapi.exporttype
|
|
26
|
+
:return: Exported Report.
|
|
27
|
+
:rtype: any
|
|
28
|
+
"""
|
|
29
|
+
return self._resourcesManager._export(self._id, type, params)
|
|
@@ -2,13 +2,15 @@ import requests
|
|
|
2
2
|
import json
|
|
3
3
|
import collections
|
|
4
4
|
|
|
5
|
+
|
|
5
6
|
from .folder import Folder
|
|
6
7
|
from .resource import Resource
|
|
7
8
|
from .downloadtype import DownloadType
|
|
8
9
|
|
|
9
10
|
from .mimetype import Application, Text, Image, Audio, Video
|
|
11
|
+
from .exporttype import ExportType
|
|
10
12
|
|
|
11
|
-
from typing import Union, OrderedDict
|
|
13
|
+
from typing import Union, OrderedDict, Dict, Any
|
|
12
14
|
|
|
13
15
|
class ResourcesManager(object):
|
|
14
16
|
"""
|
|
@@ -73,6 +75,9 @@ class ResourcesManager(object):
|
|
|
73
75
|
|
|
74
76
|
if json_result['mimeType'] == Application.ElipsePortalFolder.value:
|
|
75
77
|
return Folder(self, json_result['identity'], json_result['name'], json_result['description'])
|
|
78
|
+
elif json_result['mimeType'] == Application.OctetStream.value and json_result['name'] is not None and json_result['name'].endswith('.rdlx'):
|
|
79
|
+
from .report import Report
|
|
80
|
+
return Report(self, json_result['identity'], json_result['name'], json_result['description'])
|
|
76
81
|
else:
|
|
77
82
|
return Resource(self, json_result['identity'], json_result['name'], json_result['description'], json_result['mimeType'])
|
|
78
83
|
|
|
@@ -99,6 +104,88 @@ class ResourcesManager(object):
|
|
|
99
104
|
|
|
100
105
|
return children
|
|
101
106
|
|
|
107
|
+
def _export(self, resourcePath, type:ExportType, params:Dict[str, Any]):
|
|
108
|
+
|
|
109
|
+
import os
|
|
110
|
+
resourcePath = os.path.normpath(resourcePath)
|
|
111
|
+
|
|
112
|
+
pathSplitted = resourcePath.split("\\")
|
|
113
|
+
|
|
114
|
+
pathSplitted.pop(0)
|
|
115
|
+
|
|
116
|
+
resourcePath = "/".join(pathSplitted)
|
|
117
|
+
|
|
118
|
+
import urllib
|
|
119
|
+
resourceId = urllib.parse.quote(resourcePath, safe='')
|
|
120
|
+
|
|
121
|
+
token = self._authorizationService.getToken()
|
|
122
|
+
|
|
123
|
+
header = {'Authorization': 'Bearer {}'.format(token)}
|
|
124
|
+
url = self._webApi + "/api/reporting/reports/" + resourceId + "/render"
|
|
125
|
+
render_data = {
|
|
126
|
+
"Parameters": params,
|
|
127
|
+
"Settings": {}
|
|
128
|
+
}
|
|
129
|
+
response = requests.post(url=url, headers=header, json=render_data)
|
|
130
|
+
if response.status_code != 200 and response.status_code != 202:
|
|
131
|
+
raise Exception(response.text)
|
|
132
|
+
|
|
133
|
+
url = self._webApi + "/api/reporting/session/" + response.json()["progress"]["documentId"] + "/export/"
|
|
134
|
+
html_data = {}
|
|
135
|
+
|
|
136
|
+
if type == ExportType.Mht:
|
|
137
|
+
url += "mht"
|
|
138
|
+
html_data = {"Settings": { "MhtOutput":True}}
|
|
139
|
+
elif type == ExportType.Json:
|
|
140
|
+
url += "json"
|
|
141
|
+
html_data = {"Settings": { "QuotePropertyNames":True}}
|
|
142
|
+
elif type == ExportType.Csv:
|
|
143
|
+
url += "csv"
|
|
144
|
+
elif type == ExportType.Excel:
|
|
145
|
+
url += "xlsx"
|
|
146
|
+
elif type == ExportType.Excel2003:
|
|
147
|
+
url += "xls"
|
|
148
|
+
elif type == ExportType.Pdf:
|
|
149
|
+
url += "pdf"
|
|
150
|
+
elif type == ExportType.Tiff:
|
|
151
|
+
url += "tiff"
|
|
152
|
+
elif type == ExportType.Word:
|
|
153
|
+
url += "docx"
|
|
154
|
+
elif type == ExportType.Xml:
|
|
155
|
+
url += "xml"
|
|
156
|
+
else:
|
|
157
|
+
raise Exception("Invalid ExportType provided!")
|
|
158
|
+
|
|
159
|
+
response = requests.post(url, headers=header, json=html_data)
|
|
160
|
+
if response.status_code != 200:
|
|
161
|
+
raise Exception(response.text)
|
|
162
|
+
|
|
163
|
+
exportId = response.json()["exportId"]
|
|
164
|
+
|
|
165
|
+
ready = False
|
|
166
|
+
url = self._webApi + "/api/reporting/reports/" + exportId + "/progress"
|
|
167
|
+
while not ready:
|
|
168
|
+
response = requests.get(url, headers=header)
|
|
169
|
+
if response.status_code != 200:
|
|
170
|
+
raise Exception(response.text)
|
|
171
|
+
ready = response.json()["completed"]
|
|
172
|
+
|
|
173
|
+
name, extension = os.path.splitext(resourceId)
|
|
174
|
+
|
|
175
|
+
url = self._webApi + "/api/reporting/export/" + exportId + "/" + name
|
|
176
|
+
response = requests.get(url, headers=header, stream=True)
|
|
177
|
+
if response.status_code != 200:
|
|
178
|
+
raise Exception(response.text)
|
|
179
|
+
|
|
180
|
+
if type == ExportType.Mht or type == ExportType.Xml or type == ExportType.Csv:
|
|
181
|
+
return response.content.decode('utf-8')
|
|
182
|
+
elif type == ExportType.Json:
|
|
183
|
+
return json.loads(response.content.decode('utf-8'))
|
|
184
|
+
elif type == ExportType.Excel or type == ExportType.Excel2003 or type == ExportType.Word or type == ExportType.Pdf or type == ExportType.Tiff:
|
|
185
|
+
return response.content
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
102
189
|
def _download(self, resourceId, type):
|
|
103
190
|
|
|
104
191
|
import urllib
|
|
@@ -35,6 +35,7 @@ epmwebapi/epmsession.py
|
|
|
35
35
|
epmwebapi/epmutils.py
|
|
36
36
|
epmwebapi/epmvariable.py
|
|
37
37
|
epmwebapi/epmwebapi.py
|
|
38
|
+
epmwebapi/exporttype.py
|
|
38
39
|
epmwebapi/folder.py
|
|
39
40
|
epmwebapi/historyprocessedmodeljson.py
|
|
40
41
|
epmwebapi/historyrawmodeljson.py
|
|
@@ -62,6 +63,7 @@ epmwebapi/readitemmodeljson.py
|
|
|
62
63
|
epmwebapi/readmodeljson.py
|
|
63
64
|
epmwebapi/readresultitemmodeljson.py
|
|
64
65
|
epmwebapi/readresultmodeljson.py
|
|
66
|
+
epmwebapi/report.py
|
|
65
67
|
epmwebapi/resource.py
|
|
66
68
|
epmwebapi/resourcesmanager.py
|
|
67
69
|
epmwebapi/statuscodes.py
|
|
@@ -7,7 +7,7 @@ with open(path.join(this_directory, 'Readme.md'), encoding='utf-8') as f:
|
|
|
7
7
|
long_description = f.read()
|
|
8
8
|
|
|
9
9
|
setup(name = 'epmwebapi',
|
|
10
|
-
version = '
|
|
10
|
+
version = '6.0.40',
|
|
11
11
|
author = 'Elipse Software Ltda',
|
|
12
12
|
packages = ['epmwebapi'],
|
|
13
13
|
include_package_data=True,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = '5.0.45'
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
from threading import Timer, Thread, Event
|
|
2
|
-
|
|
3
|
-
class AutoStartTimer(object):
|
|
4
|
-
def __init__(self, spam, callback):
|
|
5
|
-
self._spam = spam
|
|
6
|
-
self._callback = callback
|
|
7
|
-
self._thread = Timer(self._spam, self.callback)
|
|
8
|
-
self._thread.start()
|
|
9
|
-
|
|
10
|
-
def callback(self):
|
|
11
|
-
self._callback()
|
|
12
|
-
self._thread = Timer(self._spam, self.callback)
|
|
13
|
-
self._thread.start()
|
|
14
|
-
|
|
15
|
-
def start(self):
|
|
16
|
-
self._thread.start()
|
|
17
|
-
|
|
18
|
-
def cancel(self):
|
|
19
|
-
self._thread.cancel()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{epmwebapi-5.0.45 → epmwebapi-6.0.40}/epmwebapi/dll_references/Elipse.Epm.AddressSpaceModel.dll
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|