Skip to content
Permalink
2a07e0621f
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
60 lines (39 sloc) 2.12 KB
Python-based command line tools for accessing a WebCTRL server via its WSDL interface
Prerequisits
------------
1) Python 2.7
2) In order to use the WSDL API you need to download and install the SUDS python package
Download suds-0.4.tar.gz here: https://pypi.python.org/pypi/suds
Install via command line: $ sudo pip install suds-0.4.tar.gz
3) If you don't want to execute the scripts from within an IDE (e.g. Pycharm) you could install
pythoninstaller to build the tools: $ sudo pip install pyinstaller
Building the tools
------------------
webctrl$ ./build_project.sh
The executables wc_* can be found in ./bin
Add the bin directory to the PATH environment variable (in your ~/.bashrc) in order to be able to
execute the wc_* commands everywhere:
export PATH="$PATH:/path/to/webctrl/bin"
Running the tools
-----------------
e.g.: webctrl$ ./dist/wc_query/wc_query
Use -h or --help with all tools in order to find out more about how to use them.
Short explanation of each tool
------------------------------
wc_query : Query the paths and devices starting from /trees/geographic
wc_getReport : Retrieve a report for a directory or a specific device
wc_getValue : Retrieve the current value of a device
wc_getTrend : Retrieve data and date for a given time period and device
Usage of the tools in another python script
-------------------------------------------
Analogous to the command line usage
./wc_query -u wsdl -n '/trees/geographic' -url 'https://webctrl.rz-berlin.mpg.de'
wc_query can be used as follows in another python script, say, ~/test.py:
import wc_query
myDictonary = {'username':'wsdl', 'password':'seife', 'node':'/trees/geographic', 'url':'https://webctrl.rz-berlin.mpg.de'}
wc_query.main(myDictonary)
To be able to import the wc_* tools append to the PYTHONPATH the webctrl directory. There are two possible ways:
1) Set the PYTHONPATH environment variable in the shell in which you run your python script that uses the tool(s):
export PYTHONPATH="$PYTHONPATH:/path/to/webctrl"
2) Set the python path inside the python script before the import statement:
sys.path.append('/path/to/webctrl')