Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
opcua-asyncio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nikola Balog
opcua-asyncio
Commits
097c6054
Commit
097c6054
authored
May 18, 2022
by
Alexander Schrode
Committed by
oroulet
May 20, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow setting client locale
parent
f4377b6d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
asyncua/client/client.py
asyncua/client/client.py
+11
-2
No files found.
asyncua/client/client.py
View file @
097c6054
import
asyncio
import
logging
from
typing
import
Union
,
Coroutine
,
Optional
from
typing
import
List
,
Union
,
Coroutine
,
Optional
from
urllib.parse
import
urlparse
from
asyncua
import
ua
...
...
@@ -63,6 +63,7 @@ class Client:
self
.
max_messagesize
=
0
# No limits
self
.
max_chunkcount
=
0
# No limits
self
.
_renew_channel_task
=
None
self
.
_locale
=
[
"en"
]
async
def
__aenter__
(
self
):
await
self
.
connect
()
...
...
@@ -103,6 +104,14 @@ class Client:
raise
TypeError
(
f"Password must be a string, got
{
pwd
}
of type
{
type
(
pwd
)
}
"
)
self
.
_password
=
pwd
def
set_locale
(
self
,
locale
:
List
[
str
])
->
None
:
"""
Sets the prefred locales of the client, the client chooses which locale he can provide.
Normaly the first matching locale in the list will be chossen.
Call this before connect()
"""
self
.
_locale
=
locale
async
def
set_security_string
(
self
,
string
:
str
):
"""
Set SecureConnection mode.
...
...
@@ -449,7 +458,7 @@ class Client:
else
:
params
.
ClientSignature
.
Algorithm
=
(
security_policies
.
SecurityPolicyBasic256
.
AsymmetricSignatureURI
)
params
.
ClientSignature
.
Signature
=
self
.
security_policy
.
asymmetric_cryptography
.
signature
(
challenge
)
params
.
LocaleIds
.
append
(
"en"
)
params
.
LocaleIds
=
self
.
_locale
if
not
username
and
not
certificate
:
self
.
_add_anonymous_auth
(
params
)
elif
certificate
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment