1
0
mirror of https://github.com/FreeOpcUa/opcua-asyncio synced 2025-10-29 17:07:18 +08:00

2406 Commits

Author SHA1 Message Date
Olivier
efd206a2d5 ruff RUF 2025-10-28 15:25:02 +01:00
Olivier
c63cc6c032 ruff format 2025-10-28 14:21:43 +01:00
Olivier
00e9886622 ruff RET 2025-10-28 14:05:45 +01:00
Olivier
5ccb8c61ac fix ruff ASYNC changes 2025-10-28 14:05:10 +01:00
Olivier
57178303d3 ruff PIE 2025-10-28 13:38:50 +01:00
Olivier
1e68e4db83 ruff G 2025-10-28 13:36:54 +01:00
Olivier
08c6c1bbf8 ruff ASYNC 2025-10-28 13:27:41 +01:00
Olivier
98316f2093 ruff YTT 2025-10-28 13:19:45 +01:00
Olivier
e3bebc0afa ruff typing fixes for min 3.10 python version
remove Union

to squash

all tests pass with both python 3.10 and 3.14
2025-10-28 13:09:48 +01:00
Olivier
46b4ff5ce8 format toml 2025-10-24 21:04:04 +02:00
Olivier
33084a1279 fix one last test 2025-10-24 21:04:04 +02:00
Olivier
5f301603d4 support type | None 2025-10-24 21:04:03 +02:00
Olivier
35359ce158 new ruff fixes 2025-10-24 21:03:39 +02:00
Olivier
bf938996a6 ruff format 2025-10-24 21:02:33 +02:00
Olivier
1d787c90e5 ruff check --fix 2025-10-24 21:02:32 +02:00
Olivier
09ba003d5b require python 3.10 since 3.9 is not suported in one month 2025-10-24 20:59:45 +02:00
Hryhorii Biloshenko
ea64b6480b fix: format import 2025-10-14 19:43:58 +02:00
Hryhorii Biloshenko
2b7c48ec78 fix: format 2025-10-14 19:43:58 +02:00
Hryhorii Biloshenko
6c90a54288 add cert chain load method to sync client 2025-10-14 19:43:58 +02:00
Alex
3d3aba5178 [pubsub] Fix conversion of UADP DataSetMessage header error status
This is just a u16, and is supposed to be the high word of a StatusCode
2025-10-14 19:43:20 +02:00
Fuzail Hamid
405c24678c Update README.md
Since the PubSub has now been implemented, just a small update to the readme
2025-10-06 11:25:49 +02:00
Olivier
b8a796f1c0 uv.lock should not be commited for a library 2025-09-20 18:58:07 +02:00
Connor Smith
c965db71ee Updated message error handling to allow the true UA exception to be thrown to improve error messages for the user. Now any UA error will be re-raised and any generic exception will be presented as unhandled. Update tests to check for the proper UA error. 2025-09-19 08:22:08 +02:00
Connor Smith
d484c00a1e Refactor error handling in UASocketProtocol
This commit simplifies the error handling in the UASocketProtocol class by removing unnecessary exception handling and the associated call to _fail_all_pending in the message parsing method. The request sending method has also been updated to streamline exception management, ensuring that connection errors are raised appropriately without altering the existing functionality.
2025-09-19 08:22:08 +02:00
Connor Smith
1d257d624f Add error handling for pending requests in UASocketProtocol
This commit enhances the UASocketProtocol class by introducing a new method, _fail_all_pending, which fails all pending request futures with the given exception. The error handling in the data parsing and request sending methods has been updated to call this new method when exceptions occur, ensuring that pending requests are properly managed in case of errors.
2025-09-19 08:22:08 +02:00
Hryhorii Biloshenko
2c02f08e04 cleanup cert gen script 2025-09-18 21:45:26 +02:00
Hryhorii Biloshenko
92c877aaeb add usage example 2025-09-18 21:45:26 +02:00
Hryhorii Biloshenko
d17e962aa1 implement at least some tests 2025-09-18 21:45:26 +02:00
Hryhorii Biloshenko
b395ce4a48 generate certificate chain (test data) 2025-09-18 21:45:26 +02:00
Hryhorii Biloshenko
d509d870bd minimize pub api change 2025-09-18 21:45:26 +02:00
Hryhorii Biloshenko
e498984eea support user auth certificate chain 2025-09-18 21:45:26 +02:00
Hryhorii Biloshenko
a43af60bd1 support communication x509 certificate chain 2025-09-18 21:45:26 +02:00
Harshith Narasimhan Srivatsa
2b6f3e5bd6 Rebase and integrate pubsub features from upstream fork (#1859)
* re commit

Fix merge errors

fix: read_attribute can optional not raise an exception

* Previously a client could not read values with bad status.
* This functionality can be toggled on and off.
* Added tests.

Fixes #856

re commit

Fix merge errors

add binary config

- Fix mypy
- Fix other errors

* rectified all styling changes

removed all auto styling edits

Applied ruff formatting on pubsub files to resolve lint failure on GitHub

* Fix UadpNetworkMessage.TimeStamp decoding, fix test_connection

Fix style

Fix or remove spurious JSON msg registrations hijacking PubSub IDs

Clear PubSub configuration when loading new one from a file

Fix typos and warnings (part 1)

Partially fix raw header parsing, more warnings (part 2)

Apply same fix to encoding

Partially fix raw header parsing (part 2)

Fix pubsub test warning from old unnecessary pytest mark

Fix style

Fix more typos and raw decoding (part 3)

Fix simple raw decoding, more warnings

Fix raw header encoding, UADP version, group version, NetworkMessage, sequence number; cleanup

Fix typos

Minor fixes and cleanup

Use unused DataSetWriter parameter

Add flags for restricted raw format PLCs

Fix format

Fix for older Python

Fix receive typo

* Fix autogeneration of PubSub extension objects

* Fix uv.lock for 1.1.8

---------

Co-authored-by: Alexander Schrode <Midix01@googlemail.com>
Co-authored-by: Harshith <harshith.srivatsa@woodplc.com>
Co-authored-by: Alex Chandel <637714+alexchandel@users.noreply.github.com>
2025-09-18 21:43:16 +02:00
Alexander Schrode
de8fa37f24 Fix wrong FilterResult
CreateDataChange  FilterResult was filled with invalid content
2025-09-12 08:52:49 +02:00
Olivier
d8a5de3fe4 new release v1.1.8 v1.1.8 2025-09-05 20:21:56 +02:00
Olivier
fe795e16ad fix release script 2025-09-05 20:21:47 +02:00
Mattis Voss
cacd6a0c35 Replace time.time() with time.monotonic() in asyncua core modules
The library currently uses time.time() for timing in multiple places,
which causes problems when the system clock changes (e.g. manual adjustments).

time.monotonic() offers a monotonic clock unaffected by system time changes,
making it more reliable for measuring time intervals and timeouts.

This commit updates all occurrences of time.time() to time.monotonic() in:

- asyncua/crypto/security_policies.py
- asyncua/server/internal_subscription.py
- asyncua/server/uaprocessor.py
- asyncua/client/ha/reconciliator.py

Addresses issues reported in https://github.com/FreeOpcUa/opcua-asyncio/issues/1848.

Tested with existing test suite. Two tests fail on master as well, unrelated to this change.
v1.1.7 v{v}
2025-08-02 09:52:12 +02:00
Olivier
b3dd3a17ff make pytest loop scope explicit 2025-07-23 16:24:34 +02:00
Olivier
a5d72a2dc2 finally unfreeze pytest-asyncio 2025-07-23 16:24:34 +02:00
Christian Granzin
cc874c30e2 Feat: Support import/export of struct and enum Field descriptions (#1851)
* parse struct and enum field descriptions when importing

* export struct and enum field descriptions

* rename
2025-07-20 15:27:55 +02:00
thegart
97095b909c Support pre 1.04 struct length fields for B&R 2025-05-05 11:57:51 +02:00
oroulet
5b1091795d fix connecting to new prosys opcua server (#1827)
* make prosys accept our certificate again in examples

* allow to send certificate without encryption or user identification as prosys now requires.
Had to fix a few new bugs that sudently appeared...

* clean imports

* remove leftover prints, less verbose when renaming struct

* remove unused variable

---------

Co-authored-by: Olivier <olivier@helitech>
2025-04-29 15:55:27 +02:00
Lukas Kaupp
120d2e8c09 Fix small bug if imported xml has also the stardard namespace included (#1832)
* fix xml issue if standard namespace is also exported in the xml export file.

* ruff reformatted

* added safe guard

---------

Co-authored-by: Lukas Kaupp <lukas.kaupp@h-da.de>
2025-04-28 14:32:17 +02:00
Lukas Kaupp
d52d319b7c Enhancement: Chunked Build ETree Function (#1833)
* Added a chunked version of build etree to prevent a server-overload because of the mass of subsequent requests.

* Added a chunked version of build etree to prevent a server-overload because of the mass of subsequent requests.
Added argument description
Extended the _add_namespace method

* ruff reformatted

---------

Co-authored-by: Lukas Kaupp <lukas.kaupp@h-da.de>
2025-04-28 14:31:53 +02:00
Christian Granzin
6b6f4bb220 Fix: Issues with missing namespace URIs when importing and exporting XMLs (#1830)
* fix dependent namespace handling for importing and exporting xmls and add tests

* fix other test cases
2025-04-28 12:38:07 +02:00
Florian Dörsch
f12f3e19b3 fix ClientNonce and/or peer_certificate may be None
The ClientNonce and also the peer_certificate can be set to None,
this fixes the resulting TypeError

```
Traceback (most recent call last):
  File "...\Python312-32\Lib\site-packages\asyncua\server\uaprocessor.py", line 147, in process_message
    return await self._process_message(typeid, requesthdr, seqhdr, body)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...\Python312-32\Lib\site-packages\asyncua\server\uaprocessor.py", line 213, in _process_message
    data = self._connection.security_policy.peer_certificate + params.ClientNonce
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
TypeError: can't concat NoneType to bytes
       ^^^^^^^^^^^^^^^^^^^^^^^
TypeError: object of type 'NoneType' has no len()
```

fixes #1821
2025-04-25 08:57:54 +02:00
Ryan Mickler
e3e02e3cfa Include support for x509 certificate chains in DER format (#1822)
* Fix certificate chain handling in x509_from_der function

This change enhances the x509_from_der function to properly handle certificate chains
by extracting and using the first certificate when a chain is detected.

When a certificate chain is received, the cryptography library raises a ValueError
with 'extradata' in the error message. This fix catches that specific error and
implements DER parsing to extract the first certificate from the chain.

This allows the library to work with certificate chains that some OPC UA servers
might provide, improving compatibility.

Fixes #1148 and #1245

* Update CHANGELOG.md with certificate chain fix

* Improve exception handling comment in x509_from_der function

* Add tests for certificate chain handling

* Fix code formatting issues

* Apply Ruff formatting changes

* Remove unused os import from test file
2025-04-19 11:13:51 +02:00
Olivier
4a11975af7 fix release script 2025-04-08 14:51:23 +02:00
Olivier
7e7c62648b v1.1.6 2025-04-08 14:51:23 +02:00
Christoph Ziebuhr
cde0e3b10d SenderCertificate shall be null if the Message is not signed 2025-04-08 12:51:35 +02:00