Wille Client Module
Using Wille Client.
Firstly, import it:
>>> import client
Instantiate a client:
>>> client = client.Client()
If we want to use local services, we need to tell client where they are:
>>> client.load_dir('../tests')
See what services we found from local folder:
>>> client.services()
[LocalWilleService(timeout_test), LocalWilleService(data), LocalWilleService(stub), LocalWilleService(upload_test)]
Services can be searched by their name:
>>> client.services(name='stub')
[LocalWilleService(stub)]
Services can be also search by their type:
>>> client.services(type='test')
[LocalWilleService(timeout_test), LocalWilleService(upload_test)]
Similarly, services can be executed (note that we need to prepare parameters):
>>> params = {'raw_data': file('../tests/data/data.txt','rb').read(), 'checksum': '525'}
>>> result = client.execute_service(name='upload_test',params=params)
You can also run a group of services. First we need to prepare a service description for every unique service/data combination:
>>> desc1 = {'name': 'upload_test', 'params': params}
Pass a list of these descriptions to grouped service execution
>>> results = client.execute_services([desc1,desc1,])
Results are available in a dictionary, indexed in the order they were given as arguments:
>>> results[0].data
'OK - checksum match (525)\r\n'
>>> results[1].data
'OK - checksum match (525)\r\n'
Hint: You can turn on debugging mode in Wille client by setting debug:
>>> client.debug = True
Wille Client
Parameters (all optional):
servicepool - Servicepool (default=None, recommended)
keyring - Init with given keyring
debug - Enable debug mode
profiles - Enable only given profiles (default=all enabled)
userdata_dir = Directory to store user/session data
Execute a service by given description
Execute multiple services by given descriptions
Launch viewer. Parameters: type - Type of the viewer:
webbrowser - Launch system’s web browser
location - Location/arguments to pass to the viewer
Load services from given directory (with given libs directory)
Load keyring (optionally from given file)
Save keyring
Find services