Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
osie
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
0
Merge Requests
0
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
Martin Manchev
osie
Commits
fcfdfa4f
Commit
fcfdfa4f
authored
Aug 02, 2023
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use username / password to authenticate against ERP5 backend.
parent
853ba03f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
opcua-to-http-gw/opcua-to-http-gw.py
opcua-to-http-gw/opcua-to-http-gw.py
+5
-0
No files found.
opcua-to-http-gw/opcua-to-http-gw.py
View file @
fcfdfa4f
...
@@ -23,11 +23,15 @@ a('--ip', help='The IP address on which the OPCUA Server runs', default="127.0.0
...
@@ -23,11 +23,15 @@ a('--ip', help='The IP address on which the OPCUA Server runs', default="127.0.0
a
(
'--port'
,
help
=
'The port on which the OPCUA Server runs'
,
default
=
"4840"
)
a
(
'--port'
,
help
=
'The port on which the OPCUA Server runs'
,
default
=
"4840"
)
a
(
'--xml'
,
help
=
'Path of XML to configure Server. See asyncua doc for more details.'
,
default
=
None
)
a
(
'--xml'
,
help
=
'Path of XML to configure Server. See asyncua doc for more details.'
,
default
=
None
)
a
(
'--erp5-url'
,
help
=
'URL of ERP5 instance to which data shall be send.'
,
default
=
None
)
a
(
'--erp5-url'
,
help
=
'URL of ERP5 instance to which data shall be send.'
,
default
=
None
)
a
(
'--erp5-username'
,
help
=
'Username of ERP5 instance to which data shall be send.'
,
default
=
None
)
a
(
'--erp5-password'
,
help
=
'Password of ERP5 instance to which data shall be send.'
,
default
=
None
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
ip
=
args
.
ip
ip
=
args
.
ip
port
=
args
.
port
port
=
args
.
port
xml
=
args
.
xml
xml
=
args
.
xml
erp5_url
=
args
.
erp5_url
erp5_url
=
args
.
erp5_url
erp5_username
=
args
.
erp5_username
erp5_password
=
args
.
erp5_password
ERP5_REQUEST_API
=
"ERP5Site_handleOPCUARequest"
ERP5_REQUEST_API
=
"ERP5Site_handleOPCUARequest"
@
dataclass
(
frozen
=
True
)
@
dataclass
(
frozen
=
True
)
...
@@ -42,6 +46,7 @@ class ERP5Handler(asyncua.common.subscription.SubHandler):
...
@@ -42,6 +46,7 @@ class ERP5Handler(asyncua.common.subscription.SubHandler):
def
call
(
self
,
http_method
=
"POST"
,
**
data
):
def
call
(
self
,
http_method
=
"POST"
,
**
data
):
params
=
urllib
.
parse
.
quote_plus
(
json
.
dumps
({
k
:
str
(
v
)
for
k
,
v
in
data
.
items
()}))
params
=
urllib
.
parse
.
quote_plus
(
json
.
dumps
({
k
:
str
(
v
)
for
k
,
v
in
data
.
items
()}))
self
.
session
.
auth
=
(
erp5_username
,
erp5_password
)
if
http_method
==
"POST"
:
if
http_method
==
"POST"
:
self
.
session
.
post
(
f"
{
self
.
uri
}
?data=
{
params
}
"
)
self
.
session
.
post
(
f"
{
self
.
uri
}
?data=
{
params
}
"
)
elif
http_method
==
"GET"
:
elif
http_method
==
"GET"
:
...
...
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