Passed
Push — master ( 76fa29...4bbb48 )
by Olivier
02:30
created

client_to_demo-this.com.main()   A

Complexity

Conditions 2

Size

Total Lines 9
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 9
nop 0
dl 0
loc 9
rs 9.95
c 0
b 0
f 0
1
import sys
2
sys.path.insert(0, "..")
3
import logging
4
import asyncio
5
6
from IPython import embed
7
8
from asyncua import Client
9
from asyncua import ua
10
11
12
13
async def main():
14
    logging.basicConfig(level=logging.WARN)
15
    async with Client("opc.tcp://opcua.demo-this.com:51210/UA/SampleServer") as client:
16
        struct = client.get_node("ns=2;i=10239")
17
        before = await struct.read_value()
18
        data = await client.load_type_definitions()  # scan server for custom structures and import them
19
        after = await struct.read_value()
20
        print("BEFORE", before)
21
        print("AFTER", after)
22
23
if __name__ == '__main__':
24
    asyncio.run(main())
25