Wille Services Module
Mostly used internally by Wille. However, a developer using Wille may need to understand how Wille Service Definitions work.
Examples:
>>> import services
Let’s first see how local services work.
Initiating an instance of a local service: >>> service = services.LocalService(‘../tests’, ‘upload_test’, ‘examples/libs’)
Some metadata for services are available, such as parameter list: >>> service.required_params [‘raw_data’, ‘checksum’]
Once instantiated, services can be executed with specified parameters: >>> result = service.execute({‘raw_data’:’<h1>Hello World!</h1>’, ‘checksum’: ‘1682’})
Result is return in ServiceData format. As an example, let’s count length of returned data: print(result.data)
A collection of service pools
Run a service matching specified criteria Parameters:
name - Service name (default=ANY) type - Service type (default=ANY) uri - Service uri (default=ANY) params - Service parameters as required by it (default=None) keyring - Keyring (default=None) prefer_index - In case several service match request, prefer this (nth) service (default=0)
keyring - Keyring (optional)
Note: minimum execution type 10 ms due use of polling
List pools
Find services by specified criteria:
HTTP Service
Executes an HTTP service. Will manage Zipblob results automatically.
Reload service
Pool for HTTP Services
Connect/update connection to a server
Find services Arguments:
type – Match by type (Default=ANY)
Local service
Reload service
Is service status ok?
Pool for local services
Base class for all Wille services
ServiceData - either input or output
Returns True/False based on whether this instance contains a successful service result.
If undetermined (such as for service input data), returns None
Pool for services
Returns services in pool matching specified criteria. At least one parameter must be specified
- Parameters:
- name - Match service any (Default=ANY) type - Service type (Default=ANY) uri - Service URI (Default=ANY)