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=<MessageSecurityMode.SignAndEncrypt: 3>)

​ 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的初始用户将被覆盖

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 200,392评论 5 470
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 84,258评论 2 377
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 147,417评论 0 332
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 53,992评论 1 272
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 62,930评论 5 360
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,199评论 1 277
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,652评论 3 390
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,327评论 0 254
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,463评论 1 294
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,382评论 2 317
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,432评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,118评论 3 315
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,704评论 3 303
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,787评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,999评论 1 255
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,476评论 2 346
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,057评论 2 341

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,269评论 0 10
  • PLEASE READ THE FOLLOWING APPLE DEVELOPER PROGRAM LICENSE...
    念念不忘的阅读 13,421评论 5 6
  • 天冷了,奶奶你在上面要穿多点衣服啊!别着凉了!一定要照顾好自己!不要让我担心!好想你啊!奶奶!今天是你离开我...
    桐桐_30b8阅读 507评论 0 1
  • 书名:好的孤独 作者:陈果 篇目:向死而生 金句: 001一沙一世界,一花一天堂;双手握无限,刹那是永恒。 002...
    颜者阅读 147评论 0 0
  • 楼台露重,月辉清浅。 雏菊扶疏影乱。
    猫恋一夏阅读 482评论 0 4