Primeri uporabe web servisa na Ubuntu 10.04 za Python in SOAP knjižico SUDS, ki jo namestimo z:
sudo easy_install suds
Nadozrni modul skrbi za dostop do naprave.
from suds.client import Client
management = Client(url)
url = 'http://<webservice_host>/lidar/Management?wsdl'
api_key = 'api_key'
username = 'username'
password = 'password'
auth_token = management.service.getAuthenticationToken(api_key, username, password)
if auth_token != None:
print 'Prijavljen! Auth token: %s' % auth_token
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
unlock = management.service.unlock(lock_token)
if unlock:
print 'Naprava odklenjena!'