A note on **kwargs for Client servicesΒΆ
Most Client methods (such as read, write, createMonitoredData, ...) have a special **kwargs attribute. Similar to a Python dictionary, the **kwargs attribute allows you to provide additional key:value pairs, in order to configure the read/write/... call more in detail.
Note
See the How to configure all settings? example for more info!
Session-related
The following kwargs are available to configure session(s). If neither of them is given, then the
defaultSessionSettings
of the client will be used instead.clientConnectionId
- Type:
int
- Example:
myClient.read([address], clientConnectionId = 2)
- Meaning: If provided, the client will use the existing session with the given clientConnectionId, to process the service call.
- Type:
sessionSettings
- Type:
SessionSettings
- Example:
myClient.read([address], sessionSettings = mySessionSettings)
- Meaning: If provided, then a session will be created with the given session settings,
in order to process the service call. If a session with these settings exists already,
then this session will be reused (unless
unique
is set to True). IfclientConnectionId
was provided, then thesessionSettings
kwarg will be ignored.
- Type:
Subscription-related
The following kwargs are available to configure session(s). If neither of them is given, then the
defaultSubscriptionSettings
of the client will be used instead. Naturally, these kwargs are only available for subscription-level requests (such as CreateMonitoredData).clientSubscriptionHandle
- Type:
int
- Example:
myClient.createMonitoredData([address], clientConnectionId = 2, clientSubscriptionHandle = 1)
- Meaning: If provided, the client will use the existing session with the given clientConnectionId, and the existing subscription with the given clientSubscriptionHandle, to process the service call.
- Type:
subscriptionSettings
- Type:
SubscriptionSettings
- Example:
myClient.createMonitoredData([address], subscriptionSettings = mySubscriptionSettings)
- Meaning: If provided, then a subscription will be created with the given subscription settings,
in order to process the service call. If a subscription with these settings exists already,
then this subscription will be reused (unless
unique
is set to True). IfclientSubscriptionHandle
was provided, then thesubscriptionSettings
kwarg will be ignored.
- Type:
Service-related
The following kwarg is available to configure the service call. If it is not given, then the default service settings (e.g.
defaultReadSettings
) of the client will be used instead.serviceSettings
- Type:
ReadSettings
,WriteSettings
, etc. - Example:
myClient.read([address], serviceSettings = myReadSettings)
- Meaning: If provided, the client will use these settings to process the service call.
If not provided, the client will use the defaults as configured by the
ClientSettings
.
- Type:
Node resolution related
Most services also accept a
translateSettings
kwarg to configure the TranslateBrowsePathToNodeIds service, which may be needed to automatically resolve any browsepaths:translateSettings
- Type:
TranslateBrowsePathsToNodeIdsSettings
- Example:
myClient.read([address], translateSettings = myTranslateSettings)
- Meaning: If provided, these settings will be used to resolve any relative addresses into
absolute addresses. If not provided, then the
defaultTranslateBrowsePathsToNodeIdsSettings
will be used instead.
- Type: