Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
487 commits
Select commit Hold shift + click to select a range
d1ff6dd
Merge pull request #656 from Granjow/feature/granjow/password-auth
oroulet Jul 24, 2018
79e09e8
BF: load shelffile now.
Jul 20, 2018
0fda2f1
fix: dictionary changed size during iteration (#660)
brubbel Jul 27, 2018
7631ae1
removed duplicate set_loop(None)
brubbel Jul 27, 2018
48c2d4c
read ref.TargetNodeClass from target node if unspecified
mathias-luedtke Jul 25, 2018
10640f4
update parent detection in XML parser
mathias-luedtke Jul 25, 2018
1bb59b7
deepcopy is not used
brubbel Jul 29, 2018
135159e
do not force setting of timestamp in datavalue for Variable Value
oroulet Aug 3, 2018
779c717
example did not work as "mydevice" is an array.. Changed the node lis…
Aug 13, 2018
df77209
forgot adress
JarlPed Aug 13, 2018
7259fa7
Merge pull request #677 from JarlPed/hotfix/xmlexport_example
oroulet Aug 13, 2018
aa6940a
fixes TimeoutError in KeepAlive thread (#665)
brubbel Aug 14, 2018
f3e23ab
implement support for subscription publishing interval 0
mathias-luedtke Aug 9, 2018
e569430
improve generation of nodeid and remove use of eval when importing st…
yangpeiren Aug 16, 2018
1add098
make xml indent a function
oroulet Aug 14, 2018
bd7f2b3
add another missing reference from standard address space
oroulet Aug 14, 2018
7bfac39
reduce number of dictionary search in set_attribute_value
oroulet Aug 14, 2018
52acb6a
fix some default values and small cleanup in structures.py
oroulet Aug 14, 2018
67f6158
less verbose
oroulet Aug 14, 2018
093cc04
Add a new server side method set_attribute_value which is faster than…
oroulet Aug 14, 2018
9b3deb7
default to not truncating strings when displaying them
oroulet Aug 14, 2018
8c85726
fix default value for python2
oroulet Aug 14, 2018
0e8177f
initialization of enum without eval
oroulet Aug 16, 2018
74e5085
one more attempt to fix Enum initalization in custom structures
oroulet Aug 18, 2018
e4f41dc
expose queuesize to subscribe_datachange
oroulet Aug 19, 2018
20026c2
new release
oroulet Aug 19, 2018
aad7817
add structure extension and its example file
yangpeiren Aug 19, 2018
e1fe225
updated _to_camel_case function
yangpeiren Aug 19, 2018
7dd33f8
refactored two classes
yangpeiren Aug 20, 2018
c73f21c
refactored DataTypeDictionaryBuilder
yangpeiren Aug 20, 2018
9dd42a6
fixed a small strange bug
yangpeiren Aug 20, 2018
9a451f4
changed add_field to OO style
yangpeiren Aug 20, 2018
cbfc83b
added tests for new classes
yangpeiren Aug 21, 2018
7eaee71
refactored paras in add_field
yangpeiren Aug 21, 2018
9421723
changed signature sequence of some methods
yangpeiren Aug 21, 2018
6fb0072
renamed some modules
yangpeiren Aug 22, 2018
ba7ad4e
fixed compatibility problems between py2 and py3
yangpeiren Aug 22, 2018
4006341
fixed bugs in tests
yangpeiren Aug 22, 2018
36a0ee9
implement uacall --method-name
mathias-luedtke Aug 27, 2018
0729c9c
Make recursive node deletion truly recursive
Nebukadneza Sep 11, 2018
b934a49
Make sure NodeClass attribute is of type UInt32
helmut-jacob Sep 6, 2018
10131b7
Added security policy Basic256Sha256
Sep 17, 2018
4a9c569
Merge pull request #697 from ephraim/master
oroulet Sep 17, 2018
64fc22a
Add support for server username/password auth
igfarm Sep 20, 2018
c10f7d4
fix naming in crypto test of class variable
Sep 19, 2018
7d89908
Added check for None on NotificationData
MagnusWestin Sep 24, 2018
6f5ea2b
Merge pull request #704 from MagnusWestin/subscription_callback_fix
oroulet Sep 25, 2018
d681240
Revert "Make sure NodeClass attribute is of type UInt32" since NodeClass
oroulet Sep 25, 2018
4375525
make sure NodeClass is of type Int32
oroulet Sep 25, 2018
2476bb6
Delete datachange_callbacks only on copy of dict to delete them from
Nebukadneza Oct 16, 2018
fa52b1d
Merge pull request #718 from Nebukadneza/fix_delete_nodes
oroulet Oct 16, 2018
00a1404
removed unused code: get_client_to_discovery
brubbel Nov 19, 2018
a4bba7a
fix race condition in UASocketClient
brubbel Nov 20, 2018
7b2af4e
fix OSError: [Errno 107] Transport endpoint is not connected
brubbel Nov 20, 2018
6c1a369
fix: don't send unsubscribe request if SecureChannel is closed
brubbel Nov 20, 2018
e318a4e
typo
brubbel Nov 20, 2018
85a4fcc
fix OSError: [Errno 9] Bad file descriptor
brubbel Nov 20, 2018
ce5e734
warning message on failure of close_secure_channel()
brubbel Nov 20, 2018
e31ad80
cleanup
brubbel Nov 20, 2018
9c115cd
cleanup
brubbel Nov 20, 2018
f68d881
fix OSError bis: [Errno 9/107]
brubbel Nov 20, 2018
1cceb10
catch socket errors ENOTCONN/EBADF: support for Py2.7
brubbel Nov 21, 2018
d8ebc8c
fix: set client-side SecureConnection state to 'open' on OpenSecureCh…
brubbel Nov 21, 2018
b1e9eaf
removed deprecated to_binary() from Variant
brubbel Nov 22, 2018
2950825
moved certificate variable from InternalServer to Server class
brubbel Nov 22, 2018
f5382f1
Merge pull request #749 from brubbel/clean4
oroulet Nov 22, 2018
de0f49b
Merge pull request #743 from brubbel/fix_ebadf_bis
oroulet Nov 22, 2018
2e04f17
Merge pull request #746 from brubbel/fix-secure-channel-open
oroulet Nov 22, 2018
bfd5d12
Merge pull request #750 from brubbel/cert-to-server
oroulet Nov 22, 2018
0892b5e
now dv returns corrent timestamps
kozachynskyi Nov 23, 2018
5b879f1
fix: Setting LocalizedText.Text attribute does not update Encoding
brubbel Nov 25, 2018
c001157
Fix various whitespace problems
Nebukadneza Nov 26, 2018
1e9fd36
Separate events’ emitting nodes from their SourceNodes
Nebukadneza Nov 26, 2018
9357c99
Adapt tests to new event-emitting-node behavior / API
Nebukadneza Nov 26, 2018
53048e3
Pull user authentication out of InternalServer class
brubbel Nov 23, 2018
5ccf372
PEP8: userManager -> user_manager
brubbel Nov 27, 2018
39dd4d6
fix: Variant.is_array flag is not set in Variant(value=otherVariant) …
brubbel Nov 25, 2018
16d7854
Variant: log warning when setting incompatible Value.
brubbel Nov 25, 2018
71c6c4b
Variant: force int->float when VariantType.Float, VariantType.Double
brubbel Nov 25, 2018
c3dc25a
Variant constructor validation check also works for prop setters
brubbel Nov 25, 2018
51ccc85
opc-ua registration and discovery refactoring
brubbel Nov 21, 2018
f35e46b
minor fixes to registration/discovery service
brubbel Nov 21, 2018
56f066e
discovery/registration services code cleanup
brubbel Nov 21, 2018
b600ff6
discovery: auto-expire registrations
brubbel Nov 22, 2018
f589cfb
removed unused import statement
brubbel Nov 22, 2018
0d762de
PEP8: threadLoop -> thread_loop
brubbel Nov 27, 2018
82ba92c
removed duplicate find_servers(). Is handled by discovery_service
brubbel Nov 27, 2018
7c69852
Surface send_hello server errors (#771)
urianchang Jan 15, 2019
77263b8
Add timeout to initial socket creation (fix #714)
Obihoernchen Dec 12, 2018
735674f
Fix PyPI badge
m-rossi Jan 19, 2019
3e5ae52
Merge pull request #787 from m-rossi/pypi-badge
oroulet Jan 19, 2019
74efbd6
print what node is giving issues when exporting
oroulet Feb 1, 2019
d7776c3
remove unnecessary assert. the length of results might be different f…
oroulet Feb 1, 2019
68f723b
make Node.delete() return the list of deleted nodes
oroulet Feb 1, 2019
80b6f0e
new release
oroulet Feb 1, 2019
d13d8a2
fix return of nodes after delete
oroulet Feb 8, 2019
3b3bd14
improvments of server-exammple.py and client-example.py
oroulet Feb 10, 2019
88514aa
Update README.md
oroulet Mar 3, 2019
cdcaed3
Update README.md
oroulet Mar 3, 2019
3728b7a
Hope to fix an import of type_definitions, and parentlink.
kozachynskyi Mar 26, 2019
0e645e4
Fix object creation
kozachynskyi Mar 26, 2019
3589634
Set EnumStrings as property of custom enumeration datatype
testunde Apr 13, 2019
c7ffa1f
update to dictionnnary builder to support opcua-modeller
oroulet Mar 19, 2019
aae74aa
fix bad bug in custom struct creation due to last retsructuring and d…
oroulet Apr 19, 2019
159d317
remove 3.6 only syntax
oroulet Apr 19, 2019
d93baa4
Implement (un)register nodes
Mar 15, 2019
b81ca9e
Add method to read multiple values in one go
Mar 18, 2019
53713cc
Return list of nodeids
Apr 8, 2019
2da7bee
Return new nodes when registering
Apr 8, 2019
567ed32
do not change Node interface for register methods
oroulet Apr 19, 2019
71ff089
Fix Server-field access for server registration at discovery server (…
testunde Apr 20, 2019
2dcec21
[subscriptions] Fix race condition in client when creating subs
djipko Apr 25, 2019
2147a7f
new release
oroulet May 4, 2019
21432df
Set OperationLimits values correctly (#838)
Nebukadneza May 15, 2019
77b9dfd
Convert StatusCode value to name and doc on-the-fly
helmut-jacob May 6, 2019
7e3140e
[Server] Fix bad return code for unsupported services
May 27, 2019
9834d49
Use correct signature algorithm in create session response
helmut-jacob Jul 9, 2019
1b2f236
Modified XML exporter to handle nodes with a null description when ex…
hhowe29 Jul 8, 2019
7939059
fix: decode password on None
biancode Jun 30, 2019
d3c4bde
fix: ignore certs and virtual environment
biancode Jun 30, 2019
1eaeedd
Fix localtime field of events
Nebukadneza Jun 4, 2019
1f2b6de
add Client.set_values() and tests
oroulet Aug 1, 2019
a94da40
Fix WhereClauseEvauluator
einarmo Sep 16, 2019
82f31c0
Fix historizing events with specified SourceNode
einarmo Sep 30, 2019
b65b92c
Add two new conditions to handle mixed-type lists
Sep 26, 2019
df9419a
Add test
Sep 26, 2019
fcf59cd
Change to debug rather than warning
Sep 26, 2019
9039459
Fix custom data type creation
amonsch Sep 9, 2019
2dca96e
tests: Remove unused imports in server tests
amonsch Sep 9, 2019
83fb9ea
update python versions
oroulet Sep 30, 2019
b2dd6f3
Opc publisher support (#900)
asinitson Oct 28, 2019
837377f
Don't wait on close_session() when underlying socket is closed (#906)
brubbel Nov 9, 2019
beb868a
Properly shut down ThreadLoop
helmut-jacob Nov 8, 2019
d3cadc4
Fix OperationLimits data type to UInt32
helmut-jacob Oct 11, 2019
c9387c7
add __str__ and __repr__ to autogenerated structures from datamodel
oroulet Dec 3, 2019
869e5f0
new release
oroulet Dec 3, 2019
ec188d1
Corrected change of security token after channel renewal
jonasgreen88 Nov 27, 2019
9210595
Allow customizing buildinfo
helmut-jacob Dec 16, 2019
8b8e79f
catch CancelledError in client, no need to report them
oroulet Dec 18, 2019
5bcb682
new release
oroulet Dec 18, 2019
5a4e3c5
readability: 0 -> ua.uaprotocol_auto.ServerState.Running
brubbel Dec 29, 2019
5237957
Merge pull request #929 from brubbel/serverstate
oroulet Dec 30, 2019
d9a9f42
fixes warning: importing the ABCs from 'collections' is deprecated
brubbel Dec 28, 2019
da76510
opcua.Client: document configuration for session timeout and secure c…
Phlogistique May 22, 2019
9502d26
readability: parameter is direction i.o. BrowseDescription
brubbel Jan 2, 2020
db56c77
fix: attrs.Historizing is Boolean, init to False
brubbel Dec 31, 2019
1ea68c9
cleanup: removed unused parameter 'external'
brubbel Jan 4, 2020
bcb3e2d
bugfix: _not_acknowledged_results has items of type ua.PublishResult
brubbel Jan 4, 2020
0aad4ad
cleanup: variant -> datavalue
brubbel Jan 6, 2020
97422bc
fix: itemId counter incremented twice
brubbel Jan 6, 2020
0380e43
[OpcuaClient][Backport async] Support of ClientSignature based on Sec…
ZuZuD Jan 24, 2020
bc4ec6a
removed unused code
brubbel Dec 31, 2019
8bba8b6
Fixed typo relevant for server endpoint security in set_security_IDs …
lsroe Jan 26, 2020
1c73bb8
fixed read history return
luisfmelo Jan 27, 2020
de6a518
Subscription: Method to reconciliate MonitoredItems
ZuZuD Feb 3, 2020
5610df5
Subscription: fix boolean name
ZuZuD Feb 18, 2020
ad1ec09
[Reconciliate MI] Add tests and fix nits
ZuZuD Feb 24, 2020
c034445
Add mock import for python2.7
ZuZuD Feb 24, 2020
6ce90ce
fixed aware datetime to winNT time format
brubbel Feb 23, 2020
a212dd6
Added test for a private key larger than 2048 bit
miomad Mar 2, 2020
0b03ed8
Fixed message padding for keys larger than 2048 bit
miomad Mar 2, 2020
af52794
more chunk debug, do not check chunk num for secure_open
oroulet Feb 17, 2020
2203cfb
update prosysexamplewith crypto
oroulet Feb 22, 2020
797abf1
rename self.logger to _logger in client, this is more correct
oroulet Feb 22, 2020
eb7af29
add client-with-encryption.py example
oroulet Feb 22, 2020
97caf7f
set max buffer size to max uint32
oroulet Feb 17, 2020
d3a9b8a
Fix bug with checking if guid is empty
Michael-List Feb 27, 2020
e6ebaee
Fix has_null_identifier check with guid
Michael-List Mar 13, 2020
c5b5b5e
Adjust test to create valid uuid
Michael-List Mar 13, 2020
9fceb5d
Add guid example to server-example.py
Michael-List Mar 13, 2020
e6ba4e6
bugfix: TwoByteNodeId does not encode namespace index
brubbel Mar 23, 2020
5262de6
FEATURE: Allow to save to file that doesn't exist
kozachynskyi Mar 27, 2020
6b30040
FIX: Typo extra space
kozachynskyi Mar 27, 2020
9133256
FIX: Missing "cryptography" warning moved to class (#984)
kozachynskyi Mar 28, 2020
4815d95
Generate custom data types with the correct namespace index
Apr 2, 2020
0220b1e
Fix _find_element_in_node to cover all input arguments
helmut-jacob Apr 16, 2020
9a2d498
Adjusting Client Signature Algorithm (FreeOpcUa/python-opcua#811)
alpex8 Apr 14, 2020
4119e74
Fix double assignment type
Apr 3, 2020
cd51885
Avoid exception in history subscription handler
helmut-jacob Apr 20, 2020
c3f1929
new release
oroulet May 2, 2020
362dc14
updated schema files from UA-Nodeset v1.04
hsd-dev Apr 23, 2020
d5c25a7
changes to adapt to v1.04
hsd-dev Apr 23, 2020
1dc7e69
auto-generated
hsd-dev Apr 23, 2020
1aa65b9
added datetime module for travis
hsd-dev Apr 23, 2020
f5e859a
fix Event.LocalType type. Make LocalizedText more robutst(although ma…
oroulet May 2, 2020
cc74ca0
regenerate address space after last changes
oroulet May 2, 2020
c61d9c5
ugly hack to make test pass, help welcome to fix that correctly
oroulet May 2, 2020
035ad9d
added: var.set_modelling_rule(True) #if false it would not be instant…
AndreasHeine May 7, 2020
17b164e
Removed the wrong print
libra146 May 15, 2020
f6f56fe
Update generate_certificate.sh (#1013)
mstfldmr May 16, 2020
dc8d240
new release
oroulet May 16, 2020
a1d8a06
issue_1029
TristanHorlamus May 18, 2020
b2d4ba3
Properly remove keepalive thread if session activation fails (#1027)
helmut-jacob May 29, 2020
12acba3
fix race connection at secure_open for client (#1042)
oroulet Jun 3, 2020
f761ccf
changed Nodeclass __str__ and __repr__ method (#1058)
AndreasHeine Jun 3, 2020
34d98f9
remove DeprecationWarning: import Iterable from collections.abc if py…
driftregion Jun 18, 2020
0d2aaf6
update
AndreasHeine Jun 17, 2020
e889da6
update
AndreasHeine Jun 19, 2020
4fe90e2
update
AndreasHeine Jun 19, 2020
e868686
cleanup
AndreasHeine Jun 19, 2020
1f81613
update: generation from spec-nodeset, node.py, ua_binary.py
AndreasHeine Jun 19, 2020
4793610
update: generation from spec-nodeset, node.py, ua_binary.py
AndreasHeine Jun 19, 2020
d295b60
Update ua_binary.py
AndreasHeine Jun 19, 2020
5aa789b
Update tests_standard_address_space.py
AndreasHeine Jun 19, 2020
2eeb47f
Update tests_standard_address_space.py
AndreasHeine Jun 19, 2020
123c1fe
added pytest
AndreasHeine Jun 19, 2020
bb4680c
Update tests_standard_address_space.py
AndreasHeine Jun 19, 2020
13b4e12
removed pytest
AndreasHeine Jun 19, 2020
3721b1a
Add list handeling for unsubbing (#1085)
swamper123 Jul 2, 2020
2487dc9
Honor option to instantiate optional children (#1088)
Nebukadneza Jul 3, 2020
41839f0
Bugfix/474 (#1081)
driftregion Jul 3, 2020
d4e17b4
new release
oroulet Jul 4, 2020
3291bea
fix python 3.8
oroulet Jul 4, 2020
3990a96
add robot nodeset example
oroulet Jul 4, 2020
bb748c2
Also treat OptionalPlaceholder ModellingRule as optional in instantiate
Nebukadneza Jul 8, 2020
57020d2
Update uatypes.py (#1094)
AndreasHeine Jul 9, 2020
3f758d8
Unsub list handle (#1097)
swamper123 Jul 17, 2020
aed7ab0
Write to the logs on invalid attribute read/write
lovasoa Jul 10, 2020
fd22bbc
Fix locking around internal_subscription queues
helmut-jacob Aug 24, 2020
5c580f6
Make sure all inverse references are removed on node deletion
helmut-jacob Jul 27, 2020
f567c95
Update client.py
starturtle Sep 11, 2020
350ef18
Update client.py
starturtle Sep 11, 2020
497accb
Fix bug where the namespace of a nodeid is migrated twice
Sep 7, 2020
954e3d7
Remove trailing whitespaces
Sep 7, 2020
fbc2e5a
Various fixes in the xmlexporter
Sep 7, 2020
8ac613a
Fix history_sql.py emitting node is not the source -> sql error
AndreasHeine Sep 3, 2020
f51d14c
Move user_manager from Server into InternalServer
JensPfeifle Sep 15, 2020
a7f21f7
Simple fix suggested by brubbel. (#1135)
Sep 21, 2020
583d970
Updating ServerStatus CurrentTime
xhuang2slb Oct 15, 2020
2952ffa
Fix get_server_node in Server
JensPfeifle Nov 9, 2020
ca42c2a
Create server-extension-object-as-method-argument.py
AndreasHeine Nov 3, 2020
278a2b3
changed return from list to tuple
AndreasHeine Nov 4, 2020
6ce8254
fix missing arg in __init__ from localizedtext
AndreasHeine Nov 30, 2020
d92ad54
Update event_generator.py Typo Error
RajuGujjalapati Nov 29, 2020
131ad8c
Reuse the same Variant(None) on emitting events for non-existant fields
helmut-jacob Nov 23, 2020
1cca33d
Update issue templates
oroulet Dec 9, 2020
21f4212
Update bug_report.md
swamper123 Jan 22, 2021
0d595e5
Update bug_report.md
swamper123 Jan 22, 2021
67e5484
fix typo
AndreasHeine Mar 3, 2021
b5dcf9e
Use environment markers for install dependencies
Mar 1, 2021
bf734df
new release
oroulet Mar 3, 2021
8582747
Also clean names for generated Enums
Koseng Mar 20, 2021
3012acf
Parse string Guid NodeId as UUID (#1141) (#1311)
gitseitanaka May 6, 2021
9c12685
Fix invalid xml serialization of DateTime value
Jun 28, 2021
67f1555
Update README.md
oroulet Oct 31, 2021
1b85c61
reject not supported identity tokens
schroeder- Apr 27, 2022
96a8ea6
support optional fields (which seems to be a combination of bit + swi…
Feb 9, 2022
2cfc9bc
ignore emtpy locale
bluhm Nov 5, 2022
9f743f6
Fix history continuation point calculation.
alexander-travov Nov 25, 2022
fdf5f3c
structures: clean names that start with numbers
Nov 18, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

### Please read, before you post!

This is a _**BUG REPORT for issues in the existing code**_.

If you have general questions, code handling problems or ideas, please use the:

Discussionsboard: https://github.com/FreeOpcUa/python-opcua/discussions <br/> or <br />
Gitter-Channel: https://gitter.im/FreeOpcUa/python-opcua

---


To save some time, please provide us following informations, if possible:


**Describe the bug** <br />
A clear and concise description of what the bug is.

**To Reproduce**<br />
Steps to reproduce the behavior incl code. <br />
If you post code, please use the "insert Code" (which is the "< >" symbol) format for a better readability.

**Expected behavior**<br />
A clear and concise description of what you expected to happen.

**Screenshots**<br />
If applicable, add screenshots to help explain your problem. <br />
You can post Screenshots directly to github, please don't use 3rd Party webpages

**Version**<br />
Python-Version:<br />
python-opcua Version (e.g. master branch, 0.9):
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
tmp_test_*
build*
MANIFEST
.idea*
Expand All @@ -21,3 +22,10 @@ examples/history.db
/.project
/.pydevproject
/.settings/

# DS_Store
.DS_Store

*.der
*.pem
venv/
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
language: python
python:
- "2.7"
- "3.4"
- "pypy"
- "3.6"
- "pypy"
- "pypy3"
# command to install dependencies
install:
- pip install python-dateutil
- pip install datetime
- pip install pytz
- pip install lxml
- if [[ $TRAVIS_PYTHON_VERSION == '3.4' ]]; then pip install cryptography ; fi
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then pip install futures ; fi
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then pip install cryptography ; fi
Expand Down
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM python:3.6

RUN pip install opcua

CMD uaserver
132 changes: 89 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Pure Python OPC UA / IEC 62541 Client and Server Python 2, 3 and pypy .
Pure Python OPC UA / IEC 62541 Client and Server Python 2, 3 and pypy.
http://freeopcua.github.io/, https://github.com/FreeOpcUa/python-opcua

[![Build Status](https://travis-ci.org/FreeOpcUa/python-opcua.svg?branch=master)](https://travis-ci.org/FreeOpcUa/python-opcua)
Expand All @@ -7,17 +7,43 @@ http://freeopcua.github.io/, https://github.com/FreeOpcUa/python-opcua
[![Codacy Badge](https://api.codacy.com/project/badge/grade/f7f9a138ee7c4541b3b794b86e61e929)](https://www.codacy.com/app/olivier-roulet/python-opcua)
[![Code Climate](https://codeclimate.com/github/FreeOpcUa/python-opcua/badges/gpa.svg)](https://codeclimate.com/github/FreeOpcUa/python-opcua)

[![PyPI Oackage](https://badge.fury.io/py/freeopcua.svg)](https://badge.fury.io/py/freeopcua)
[![PyPI Package](https://badge.fury.io/py/opcua.svg)](https://badge.fury.io/py/opcua)

# The library is deprecated.
# Please switch to : [opcua-asyncio](https://github.com/FreeOpcUa/opcua-asyncio) which also has a [sync-wrapper](https://github.com/FreeOpcUa/opcua-asyncio/blob/master/asyncua/sync.py), with very few changes in API**

**PR to fix bugs to python-opcua are welcome, but if you want to write new fancy features or architectural changes, please look at opcua-asyncio**

**Why asyncio? because it makes code easier to read and safer(read: less chances for bugs) and since python is monoprocess it might even be faster. It is also a good timing to remove all Python2 code**


OPC UA binary protocol implementation is quasi complete and has been tested against many different OPC UA stacks. API offers both a low level interface to send and receive all UA defined structures and high level classes allowing to write a server or a client in a few lines. It is easy to mix high level objects and low level UA calls in one application.

Most low level code is autogenerated from xml specification, thus adding missing functionnality to client or server is often trivial.
Most low level code is autogenerated from xml specification, thus adding missing functionality to client or server is often trivial.

coverage.py reports a test coverage of over 95 % of code, most of non-tested code is autogenerated code that is not used yet.


# Installation

With pip (note: the package was ealier called freeopcua)

pip install opcua

Ubuntu:

Using Python > 3.4 the dependencies are cryptography and dateutil. If using python 2.7 or pypy < 3 you also need to install enum34, trollius(asyncio), and futures(concurrent.futures), with pip for example.
apt install python-opcua # Library
apt install python-opcua-tools # Command-line tools

coveryage.py reports a test coverage of over 90% of code, most of non-tested code is autogenerate code that is not used yet.
Dependencies:
* Python > 3.4: `cryptography`, `dateutil`, `lxml` and `pytz`.
* Python 2.7 or pypy < 3: you also need to install `enum34`, `trollius` (`asyncio`), and `futures` (`concurrent.futures`),
with pip for example.

Some documentation is available at http://python-opcua.readthedocs.org/en/latest/

# Documentation

Some documentation is available on [ReadTheDocs](http://python-opcua.readthedocs.org/en/latest/).

A simple GUI client is available: https://github.com/FreeOpcUa/opcua-client-gui

Expand All @@ -27,23 +53,26 @@ Minimal client example: https://github.com/FreeOpcUa/python-opcua/blob/master/ex
Minimal server example: https://github.com/FreeOpcUa/python-opcua/blob/master/examples/server-minimal.py

A set of command line tools also available: https://github.com/FreeOpcUa/python-opcua/tree/master/tools
* uadiscover (find_servers, get_endpoints and find_servers_on_network calls)
* uals (list children of a node)
* uahistoryread
* uaread (read attribute of a node)
* uawrite (write attribute of a node)
* uacall (call method of a node)
* uasubscribe (subscribe to a node and print datachange events)
* uaclient (connect to server and start python shell)
* uaserver (starts a demo OPC UA server)
* `uadiscover `(find_servers, get_endpoints and find_servers_on_network calls)
* `uals `(list children of a node)
* `uahistoryread`
* `uaread `(read attribute of a node)
* `uawrite `(write attribute of a node)
* `uacall `(call method of a node)
* `uasubscribe `(subscribe to a node and print datachange events)
* `uaclient `(connect to server and start python shell)
* `uaserver `(starts a demo OPC UA server)
`tools/uaserver --populate --certificate cert.pem --private_key pk.pem`

How to generate certificate: https://github.com/FreeOpcUa/python-opcua/tree/master/examples/generate_certificate.sh

tools/uaserver --populate --certificate cert.pem --private_key pk.pem
## Client

What works:

Client: what works:
* connection to server, opening channel, session
* browsing and reading attributes value
* gettings nodes by path and nodeids
* getting nodes by path and nodeids
* creating subscriptions
* subscribing to items for data change
* subscribing to events
Expand All @@ -55,19 +84,24 @@ Client: what works:
* communication encryption
* removing nodes

Tested servers: freeopcua C++, freeopcua Python, prosys, kepware, beckoff
Tested servers: freeopcua C++, freeopcua Python, prosys, kepware, beckhoff, winCC, B&R, …

Not implemented yet:

Client: what is not implemented yet
* localized text feature
* adding some missing modify methods
* XML protocol
* UDP
* maybe automatic reconnection...


## Server

What works:

Server: what works:
* creating channel and sessions
* read/set attributes and browse
* gettings nodes by path and nodeids
* autogenerate addres space from spec
* getting nodes by path and nodeids
* autogenerate address space from spec
* adding nodes to address space
* datachange events
* events
Expand All @@ -80,43 +114,55 @@ Server: what works:

Tested clients: freeopcua C++, freeopcua Python, uaexpert, prosys, quickopc

Server: what is not implemented
Not yet implemented:

* more high level solution to create custom structures
* UDP
* session restore
* alarms
* XML protocol
* views
* localized text features
* better securty model with users and password
* adding some missing modify methods
* better security model with users and password


Server: Running on a Raspberry Pi
### Running a server on a Raspberry Pi

Setting up the standard address-space from XML is the most time-consuming step of the startup process which may lead to
long startup times on less powerful devices like a Raspberry Pi. By passing a path to a cache-file to the server constructor,
a shelve holding the address space will be created during the first startup. All following startups will make use of the
cache-file which leads to significantly better startup performance (~3.5 vs 125 seconds on a Raspberry Pi Model B).

Setting up the standard address-space from XML is the most time-consuming step of the startup process which may lead to long startup times on less powerful devices like a Raspberry Pi. By passing a path to a cache-file to the server constructor, a shelve holding the address space will be created during the first startup. All following startups will make use of the cache-file which leads to significantly better startup performance (~3.5 vs 125 seconds on a Raspbery Pi Model B).

# Development

Code follows PEP8 apart for line lengths which should be max 120 characters and OPC UA structures that keep camel case from XML definition.
Code follows PEP8 apart for line lengths which should be max 120 characters and OPC UA structures that keep camel case
from XML definition.

All protocol code is under opcua directory

- opcua/ua contains all UA structures from specification, most are autogenerated
- opcua/common contains high level objects and methods used both in server and client
- opcua/client contains client specific code
- opcua/server contains server specific code
- opcua/utils contains some utilities function and classes
- opcua/tools contains code for command lines tools
- schemas contains the XML and text files from specification and the python scripts used to autogenerate code
- tests contains tests
- docs contains files to auto generate documentation from doc strings
- examples contains many example files
- tools contains python scripts that can be used to run command line tools from repository without installing
- `opcua/ua` contains all UA structures from specification, most are autogenerated
- `opcua/common` contains high level objects and methods used both in server and client
- `opcua/client` contains client specific code
- `opcua/server` contains server specific code
- `opcua/utils` contains some utilities function and classes
- `opcua/tools` contains code for command lines tools
- `schemas` contains the XML and text files from specification and the python scripts used to autogenerate code
- `tests` contains tests
- `docs` contains files to auto generate documentation from doc strings
- `examples` contains many example files
- `tools` contains python scripts that can be used to run command line tools from repository without installing

## Running tests:

python tests.py
```
./run-tests.sh
```

## Coverage

```
coverage run tests.py
coverage html
firefox htmlcov/index.html

```
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ A simple GUI client is available: https://github.com/FreeOpcUa/opcua-client-gui

Examples: https://github.com/FreeOpcUa/python-opcua/tree/master/examples

Minimal client example: https://github.com/FreeOpcUa/python-opcua/tree/master/examples/minimal-client.py
Minimal server example: https://github.com/FreeOpcUa/python-opcua/tree/master/examples/minimal-server.py
Minimal client example: https://github.com/FreeOpcUa/python-opcua/blob/master/examples/client-minimal.py
Minimal server example: https://github.com/FreeOpcUa/python-opcua/blob/master/examples/server-minimal.py


Contents:
Expand Down
Binary file added examples/certificate-3072-example.der
Binary file not shown.
12 changes: 9 additions & 3 deletions examples/client-example.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def event_notification(self, event):
# client = Client("opc.tcp://admin@localhost:4840/freeopcua/server/") #connect using a user
try:
client.connect()
client.load_type_definitions() # load definition of server specific structures/extension objects

# Client has a few methods to get proxy to UA nodes that should always be in address space such as Root or Objects
root = client.get_root_node()
Expand All @@ -57,15 +58,20 @@ def event_notification(self, event):
# get a specific node knowing its node id
#var = client.get_node(ua.NodeId(1002, 2))
#var = client.get_node("ns=3;i=2002")
#var = client.get_node("ns=2;g=1be5ba38-d004-46bd-aa3a-b5b87940c698")
#print(var)
#var.get_data_value() # get value of node as a DataValue object
#var.get_value() # get value of node as a python builtin
#var.set_value(ua.Variant([23], ua.VariantType.Int64)) #set node value using explicit data type
#var.set_value(3.9) # set node value using implicit data type

# gettting our namespace idx
uri = "http://examples.freeopcua.github.io"
idx = client.get_namespace_index(uri)

# Now getting a variable node using its browse path
myvar = root.get_child(["0:Objects", "2:MyObject", "2:MyVariable"])
obj = root.get_child(["0:Objects", "2:MyObject"])
myvar = root.get_child(["0:Objects", "{}:MyObject".format(idx), "{}:MyVariable".format(idx)])
obj = root.get_child(["0:Objects", "{}:MyObject".format(idx)])
print("myvar is: ", myvar)

# subscribing to a variable node
Expand All @@ -80,7 +86,7 @@ def event_notification(self, event):
# sub.delete()

# calling a method on server
res = obj.call_method("2:multiply", 3, "klk")
res = obj.call_method("{}:multiply".format(idx), 3, "klk")
print("method result is: ", res)

embed()
Expand Down
4 changes: 4 additions & 0 deletions examples/client-minimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
myvar = root.get_child(["0:Objects", "2:MyObject", "2:MyVariable"])
obj = root.get_child(["0:Objects", "2:MyObject"])
print("myvar is: ", myvar)
print("myobj is: ", obj)

# Stacked myvar access
# print("myvar is: ", root.get_children()[0].get_children()[1].get_variables()[0].get_value())

finally:
client.disconnect()
26 changes: 26 additions & 0 deletions examples/client-with-encryption.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import sys
sys.path.insert(0, "..")
import logging

from IPython import embed

from opcua import Client


if __name__ == "__main__":
logging.basicConfig(level=logging.WARNING)
client = Client("opc.tcp://localhost:4840/freeopcua/server/")
#client = Client("opc.tcp://localhost:53530/OPCUA/SimulationServer/")
client.set_security_string("Basic256Sha256,SignAndEncrypt,certificate-example.der,private-key-example.pem")
client.application_uri = "urn:example.org:FreeOpcUa:python-opcua"
client.secure_channel_timeout = 10000
client.session_timeout = 10000
try:
client.connect()
root = client.get_root_node()
objects = client.get_objects_node()
print("childs og objects are: ", objects.get_children())

embed()
finally:
client.disconnect()
Loading