Conditions | 2 |
Total Lines | 17 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import asyncio |
||
15 | async def task(loop): |
||
16 | url = "opc.tcp://0.0.0.0:4840/freeopcua/server/" |
||
17 | try: |
||
18 | client = Client(url=url) |
||
19 | await client.set_security( |
||
20 | SecurityPolicyBasic256Sha256, |
||
21 | certificate_path=cert, |
||
22 | private_key_path=private_key |
||
23 | ) |
||
24 | await client.connect() |
||
25 | root = client.nodes.root |
||
26 | print(await root.get_children()) |
||
27 | |||
28 | except Exception: |
||
29 | _logger.exception('error') |
||
30 | finally: |
||
31 | await client.disconnect() |
||
32 | |||
43 |