Python-OPCUA-Client

class opcua.client.client.Client(url, timeout=4)

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

​ 高级客户端连接到OPC-UA服务器.

​ 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.

​ 这个类可以方便地连接和浏览地址空间。它计划尽可能公开更多的功能,但是如果您想要更多的灵活性,可以使用UaClient对象,它可以作为Self.uaclient提供原始的OPC-UA服务接口。

activate_session(username=None, password=None, certificate=None)

​ Activate session using either username and password or private_key

​ Activate session用于设定用户名和密码或private_key

close_secure_channel()
close_session()

​ Close session

​ 关闭session

connect()

​ High level method Connect, create and activate session

​ 高级连接方式,创建与激活session

connect_and_find_servers()

​ Connect, ask server for a list of known servers, and disconnect

​ 连接,向服务器询问已知服务器的列表,然后断开连接

connect_and_find_servers_on_network()

​ Connect, ask server for a list of known servers on network, and disconnect

​ 连接,向服务器询问网络上已知服务器的列表,然后断开连接

connect_and_get_server_endpoints()

​ Connect, ask server for endpoints, and disconnect

​ 连接,向服务器询问端点,并断开连接

connect_socket()

​ connect to socket defined in url

​ 连接到url中定义的套接字

create_session()

​ send a CreateSessionRequest to server with reasonable parameters. If you want o modify settings look at code of this methods and make your own

​ 向服务器发送含有有合理参数的CreateSessionRequest。如果希望修改设置,请查看此方法的代码并自己创建

create_subscription(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 milliseconds 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.

​ 创建一个监听方法。

​ 返回一个监听对象,该对象允许订阅服务器处理程序参数上的事件或数据,它是一个具有data_change或事件方法的类。

​ 参数以毫秒为单位的发布间隔,以及CreateSubscriptionParameters实例。如果opcua-server对默认选项有问题,则应该使用第二个选项。当接收到来自服务器的标识时,将调用这些方法。参见示例-client.py。

​ 不要从这些方法执行缓慢的网络操作,因为它们是直接从接收线程调用的。

​ 这是一个设计的选择,启动另一个线程,如果你需要做这样的事情。

delete_nodes(nodes, recursive=False)
disconnect()

​ High level method Close session, secure channel and socket

​ 高级方法用于关闭会话、安全通道、socket

disconnect_socket()
export_xml(nodes, path)

​ Export defined nodes to xml

​ 将定义的节点导出到XML

static find_endpoint(endpoints, security_mode, policy_uri)

​ Find endpoint with required security mode and policy URI

​ 查找具有所需安全模式和策略URI的端点,

find_servers(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

​ 向服务器发送FindServer请求。答案应该是服务器知道的服务器列表,可以提供URI列表,只有具有匹配URI的服务器才会返回

find_servers_on_network()
get_endpoints()
get_namespace_array()
get_namespace_index(uri)
get_node(nodeid)

​ Get node using NodeId object or a string representing a NodeId

​ 使用NodeId对象或表示NodeId的字符串获取节点

get_objects_node()
get_root_node()
get_server_node()
import_xml(path)

​ Import nodes defined in xml

​ 用XML定义的导入节点

load_client_certificate(path)

​ load our certificate from file, either pem or der

​ 从文件(pem或der)加载我们的证书。

load_private_key(path)

​ Load user private key. This is used for authenticating using certificate

​ 加载用户私钥。这用于使用证书进行身份验证。

load_type_definitions(nodes=None)
open_secure_channel(renew=False)

​ Open secure channel, if renew is True, renew channel

​ 开放安全通道,如果更新为真,则更新通道

register_namespace(uri)

​ Register a new namespace. Nodes should in custom namespace, not 0. This method is mainly implemented for symetry with server

​ 注册一个新的命名空间。节点应该在自定义命名空间中,而不是0。该方法主要是在服务器上实现的。

register_server(server, discovery_configuration=None)

​ register a server to discovery server if discovery_configuration is provided, the newer register_server2 service call is used

​ 如果提供发现配置,则将服务器注册到发现服务器,则使用更新的寄存器_server 2服务调用

send_hello()

​ Send OPC-UA hello to server

​ 向服务器发送opc-UA你好

server_policy_id(token_type, default)

​ Find PolicyId of server’s UserTokenPolicy by token_type. Return default if there’s no matching UserTokenPolicy.

​ 通过Token_Type查找服务器的UserTokenPolicy的POLICYID。如果没有匹配的UserTokenPolicy,则返回默认值。

server_policy_uri(token_type)

​ Find SecurityPolicyUri of server’s UserTokenPolicy by token_type. If SecurityPolicyUri is empty, use default SecurityPolicyUri of the endpoint

​ 按Token_type查找服务器的UserTokenPolicy的SecurityPolicyURI。如果SecurityPolicyURI为空,则使用端点的默认SecurityPolicyURIkenPolicy.sed

set_password(pwd)

​ Set user password for the connection. initial password from the URL will be overwritten

​ 为连接设置用户密码。来自URL的初始密码将被覆盖

set_security(policy, certificate_path, private_key_path, server_certificate_path=None, mode=)

​ Set SecureConnection mode. Call this before connect()

​ 设置SecureConnection模式。在CONNECT()之前调用它

set_security_string(string)

​ Set SecureConnection mode.

​ String format: Policy,Mode,certificate,private_key[,server_private_key]

​ Policy:Basic128Rsa15 or Basic256,

​ Mode : Sign or SignAndEncrypt

​ certificate, private_key and server_private_key: paths to .pem or .der files

​ Call this before connect()

​ 设置SecureConnection模式。

​ 字符串格式:Policy,Mode,certificate,private_key[,server_private_key]

​ 其中Policy为Basic128Rsa15 or Basic256,

​ Mode为Sign or SignAndEncrypt

​ certificate, private_key and server_private_key为 .pem 或 .der 文件的路径

set_user(username)

​ Set user name for the connection. initial user from the URL will be overwritten

​ 为连接设置用户名。来自URL的初始用户将被覆盖

你可能感兴趣的:(Python-OPCUA-Client)