Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
opcua.client.client.Client Class Reference
Inheritance diagram for opcua.client.client.Client:
Inheritance graph
[legend]

Public Member Functions

def __enter__ (self)
 
def __exit__ (self, exc_type, exc_value, traceback)
 
def __init__ (self, url, timeout=4)
 
def activate_session (self, username=None, password=None, certificate=None)
 
def close_secure_channel (self)
 
def close_session (self)
 
def connect (self)
 
def connect_and_find_servers (self)
 
def connect_and_find_servers_on_network (self)
 
def connect_and_get_server_endpoints (self)
 
def connect_socket (self)
 
def create_session (self)
 
def create_subscription (self, period, handler)
 
def delete_nodes (self, nodes, recursive=False)
 
def disconnect (self)
 
def disconnect_socket (self)
 
def find_servers (self, uris=None)
 
def find_servers_on_network (self)
 
def get_endpoints (self)
 
def get_namespace_array (self)
 
def get_namespace_index (self, uri)
 
def get_node (self, nodeid)
 
def get_objects_node (self)
 
def get_root_node (self)
 
def get_server_node (self)
 
def load_client_certificate (self, path)
 
def load_private_key (self, path)
 
def open_secure_channel (self, renew=False)
 
def register_server (self, server, discovery_configuration=None)
 
def send_hello (self)
 
def server_policy_id (self, token_type, default)
 
def server_policy_uri (self, token_type)
 
def set_security (self, policy, certificate_path, private_key_path, server_certificate_path=None, mode=ua.MessageSecurityMode.SignAndEncrypt)
 
def set_security_string (self, string)
 

Static Public Member Functions

def find_endpoint (endpoints, security_mode, policy_uri)
 

Public Attributes

 application_uri
 
 description
 
 keepalive
 
 logger
 
 name
 
 nodes
 
 product_uri
 
 secure_channel_id
 
 secure_channel_timeout
 
 security_policy
 
 server_url
 
 session_timeout
 
 uaclient
 
 user_certificate
 
 user_private_key
 

Private Member Functions

def _add_anonymous_auth (self, params)
 
def _add_certificate_auth (self, params, certificate, challenge)
 
def _add_user_auth (self, params, username, password)
 
def _encrypt_password (self, password, policy_uri)
 

Private Attributes

 _policy_ids
 
 _server_nonce
 
 _session_counter
 

Detailed Description

High level client to connect to an OPC-UA server.

This class makes it easy to connect and browse address space.
It attemps to expose as much functionality as possible
but if you want more flexibility it is possible and adviced to
use UaClient object, available as self.uaclient
which offers the raw OPC-UA services interface.

Definition at line 70 of file client.py.

Constructor & Destructor Documentation

def opcua.client.client.Client.__init__ (   self,
  url,
  timeout = 4 
)
:param url: url of the server.
    if you are unsure of url, write at least hostname
    and port and call get_endpoints

:param timeout:
    Each request sent to the server expects an answer within this
    time. The timeout is specified in seconds.

Definition at line 82 of file client.py.

Member Function Documentation

def opcua.client.client.Client.__enter__ (   self)

Definition at line 111 of file client.py.

def opcua.client.client.Client.__exit__ (   self,
  exc_type,
  exc_value,
  traceback 
)

Definition at line 115 of file client.py.

def opcua.client.client.Client._add_anonymous_auth (   self,
  params 
)
private

Definition at line 401 of file client.py.

def opcua.client.client.Client._add_certificate_auth (   self,
  params,
  certificate,
  challenge 
)
private

Definition at line 405 of file client.py.

def opcua.client.client.Client._add_user_auth (   self,
  params,
  username,
  password 
)
private

Definition at line 416 of file client.py.

def opcua.client.client.Client._encrypt_password (   self,
  password,
  policy_uri 
)
private

Definition at line 434 of file client.py.

def opcua.client.client.Client.activate_session (   self,
  username = None,
  password = None,
  certificate = None 
)
Activate session using either username and password or private_key

Definition at line 380 of file client.py.

def opcua.client.client.Client.close_secure_channel (   self)

Definition at line 271 of file client.py.

def opcua.client.client.Client.close_session (   self)
Close session

Definition at line 445 of file client.py.

def opcua.client.client.Client.connect (   self)
High level method
Connect, create and activate session

Definition at line 218 of file client.py.

def opcua.client.client.Client.connect_and_find_servers (   self)
Connect, ask server for a list of known servers, and disconnect

Definition at line 194 of file client.py.

def opcua.client.client.Client.connect_and_find_servers_on_network (   self)
Connect, ask server for a list of known servers on network, and disconnect

Definition at line 206 of file client.py.

def opcua.client.client.Client.connect_and_get_server_endpoints (   self)
Connect, ask server for endpoints, and disconnect

Definition at line 182 of file client.py.

def opcua.client.client.Client.connect_socket (   self)
connect to socket defined in url

Definition at line 238 of file client.py.

def opcua.client.client.Client.create_session (   self)
send a CreateSessionRequest to server with reasonable parameters.
If you want o modify settings look at code of this methods
and make your own

Definition at line 316 of file client.py.

def opcua.client.client.Client.create_subscription (   self,
  period,
  handler 
)
Create a subscription.
returns a Subscription object which allow
to subscribe to events or data on server
handler argument is a class with data_change and/or event methods.
period argument is either a publishing interval in seconds or a 
CreateSubscriptionParameters instance. The second option should be used,
if the opcua-server has problems with the default options.
These methods will be called when notfication from server are received.
See example-client.py.
Do not do expensive/slow or network operation from these methods
since they are called directly from receiving thread. This is a design choice,
start another thread if you need to do such a thing.  

Definition at line 468 of file client.py.

def opcua.client.client.Client.delete_nodes (   self,
  nodes,
  recursive = False 
)

Definition at line 503 of file client.py.

def opcua.client.client.Client.disconnect (   self)
High level method
Close session, secure channel and socket

Definition at line 229 of file client.py.

def opcua.client.client.Client.disconnect_socket (   self)

Definition at line 244 of file client.py.

def opcua.client.client.Client.find_endpoint (   endpoints,
  security_mode,
  policy_uri 
)
static
Find endpoint with required security mode and policy URI

Definition at line 119 of file client.py.

def opcua.client.client.Client.find_servers (   self,
  uris = None 
)
send a FindServer request to the server. The answer should be a list of
servers the server knows about
A list of uris can be provided, only server having matching uris will be returned

Definition at line 299 of file client.py.

def opcua.client.client.Client.find_servers_on_network (   self)

Definition at line 312 of file client.py.

def opcua.client.client.Client.get_endpoints (   self)

Definition at line 274 of file client.py.

def opcua.client.client.Client.get_namespace_array (   self)

Definition at line 495 of file client.py.

def opcua.client.client.Client.get_namespace_index (   self,
  uri 
)

Definition at line 499 of file client.py.

def opcua.client.client.Client.get_node (   self,
  nodeid 
)
Get node using NodeId object or a string representing a NodeId

Definition at line 462 of file client.py.

def opcua.client.client.Client.get_objects_node (   self)

Definition at line 456 of file client.py.

def opcua.client.client.Client.get_root_node (   self)

Definition at line 453 of file client.py.

def opcua.client.client.Client.get_server_node (   self)

Definition at line 459 of file client.py.

def opcua.client.client.Client.load_client_certificate (   self,
  path 
)
load our certificate from file, either pem or der

Definition at line 170 of file client.py.

def opcua.client.client.Client.load_private_key (   self,
  path 
)
Load user private key. This is used for authenticating using certificate

Definition at line 176 of file client.py.

def opcua.client.client.Client.open_secure_channel (   self,
  renew = False 
)
Open secure channel, if renew is True, renew channel

Definition at line 254 of file client.py.

def opcua.client.client.Client.register_server (   self,
  server,
  discovery_configuration = None 
)
register a server to discovery server
if discovery_configuration is provided, the newer register_server2 service call is used

Definition at line 279 of file client.py.

def opcua.client.client.Client.send_hello (   self)
Send OPC-UA hello to server

Definition at line 247 of file client.py.

def opcua.client.client.Client.server_policy_id (   self,
  token_type,
  default 
)
Find PolicyId of server's UserTokenPolicy by token_type.
Return default if there's no matching UserTokenPolicy.

Definition at line 356 of file client.py.

def opcua.client.client.Client.server_policy_uri (   self,
  token_type 
)
Find SecurityPolicyUri of server's UserTokenPolicy by token_type.
If SecurityPolicyUri is empty, use default SecurityPolicyUri
of the endpoint

Definition at line 366 of file client.py.

def opcua.client.client.Client.set_security (   self,
  policy,
  certificate_path,
  private_key_path,
  server_certificate_path = None,
  mode = ua.MessageSecurityMode.SignAndEncrypt 
)
Set SecureConnection mode.
Call this before connect()

Definition at line 153 of file client.py.

def opcua.client.client.Client.set_security_string (   self,
  string 
)
Set SecureConnection mode. String format:
Policy,Mode,certificate,private_key[,server_private_key]
where Policy is Basic128Rsa15 or Basic256,
    Mode is Sign or SignAndEncrypt
    certificate, private_key and server_private_key are
paths to .pem or .der files
Call this before connect()

Definition at line 131 of file client.py.

Member Data Documentation

opcua.client.client.Client._policy_ids
private

Definition at line 103 of file client.py.

opcua.client.client.Client._server_nonce
private

Definition at line 343 of file client.py.

opcua.client.client.Client._session_counter
private

Definition at line 107 of file client.py.

opcua.client.client.Client.application_uri

Definition at line 97 of file client.py.

opcua.client.client.Client.description

Definition at line 96 of file client.py.

opcua.client.client.Client.keepalive

Definition at line 108 of file client.py.

opcua.client.client.Client.logger

Definition at line 93 of file client.py.

opcua.client.client.Client.name

Definition at line 95 of file client.py.

opcua.client.client.Client.nodes

Definition at line 109 of file client.py.

opcua.client.client.Client.product_uri

Definition at line 98 of file client.py.

opcua.client.client.Client.secure_channel_id

Definition at line 100 of file client.py.

opcua.client.client.Client.secure_channel_timeout

Definition at line 101 of file client.py.

opcua.client.client.Client.security_policy

Definition at line 99 of file client.py.

opcua.client.client.Client.server_url

Definition at line 94 of file client.py.

opcua.client.client.Client.session_timeout

Definition at line 102 of file client.py.

opcua.client.client.Client.uaclient

Definition at line 104 of file client.py.

opcua.client.client.Client.user_certificate

Definition at line 105 of file client.py.

opcua.client.client.Client.user_private_key

Definition at line 106 of file client.py.


The documentation for this class was generated from the following file:


ros_opcua_impl_python_opcua
Author(s): Denis Štogl , Daniel Draper
autogenerated on Tue Jan 19 2021 03:12:44