Uporaba
================
Primeri uporabe web servisa na Ubuntu 10.04 za Python in SOAP knjižico `SUDS `_, ki jo namestimo z: ::
sudo easy_install suds
Nadzorni modul
--------------
Nadozrni modul skrbi za dostop do naprave.
::
from suds.client import Client
management = Client(url)
url = 'http:///lidar/Management?wsdl'
api_key = 'api_key'
username = 'username'
password = 'password'
Avtentikacija
^^^^^^^^^^^^^
::
auth_token = management.service.getAuthenticationToken(api_key, username, password)
if auth_token != None:
print 'Prijavljen! Auth token: %s' % auth_token
Zaklep
^^^^^^
::
status = management.service.getStatus(auth_token)
if status == 'unlocked':
lock_token = management.service.getLockToken(auth_token)
if lock_token != None:
print 'Naprava zaklenjena! Lock token: %s' % lock_token
# TODO: Uporaba zaklenjene naprave z uporabo lock_token
Odklep
^^^^^^
::
unlock = management.service.unlock(lock_token)
if unlock:
print 'Naprava odklenjena!'