Skip to content

Commit 17e92ce

Browse files
committed
Added new 1.3.0 features to example
1 parent 07be5b0 commit 17e92ce

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

examples/services and logs example.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,19 @@ def ErrorHandler(err):
110110
except Exception as err:
111111
ErrorHandler(err)
112112

113+
# Export the Project Configuration as JSON from the Kepware Server instance. Provides the same information as saving the
114+
# project file as JSON in the Configuration UI locally.
115+
projectJson = server.export_project_configuration()
116+
try:
117+
print("{} - {}".format("Here is the full Project Configuration as JSON", json.dumps(projectJson, indent=4)))
118+
except Exception as err:
119+
ErrorHandler(err)
120+
121+
# Import the Project Configuration from JSON. This service acts like a FILE->OPEN action and
122+
# stop communications while the new project replaces the current project in the Kepware runtime.
123+
try:
124+
r = server.import_project_configuration(projectJson)
125+
print("{} - {}".format("Executing Project Import service", r))
126+
print('{} - {}'.format("Read Service Status", server.service_status(r)))
127+
except Exception as err:
128+
ErrorHandler(err)

0 commit comments

Comments
 (0)