Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dmx-contrib
py4dmx
Commits
7d7bf222
Commit
7d7bf222
authored
Mar 30, 2022
by
Juergen Neumann
Browse files
added -SG (send_get) option.
parent
19c960d0
Pipeline
#16136
passed with stages
in 13 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
dmx.py
View file @
7d7bf222
...
...
@@ -653,6 +653,17 @@ def create_assoc(payload, workspace=None):
return
(
assoc_id
)
def
send_get
(
url
):
"""
This function sends a GET request to custom (a plugin) REST resource.
"""
## if workspace in None, the default workspace should come from config:
if
VERBOSE
:
print
(
"SEND GET : Sending GET to '%s'"
%
url
)
response
=
get_response
(
url
)
return
(
response
)
def
send_post
(
url
,
workspace
=
None
):
"""
This function sends a POST request to custom (a plugin) REST resource.
...
...
@@ -1193,6 +1204,11 @@ def main(args):
required
=
False
,
default
=
None
)
parser
.
add_argument
(
'-SG'
,
'--send_get'
,
help
=
'Sends GET request to given resource endpoint.'
,
default
=
None
)
parser
.
add_argument
(
'-SP'
,
'--send_post'
,
help
=
'Sends simple POST request to given resource endpoint.
\
...
...
@@ -1430,8 +1446,8 @@ def main(args):
else
:
print
(
"ERROR! Missing username of new member or missing workspace name."
)
if
argsdict
[
'send_
pos
t'
]:
data
=
send_
pos
t
(
argsdict
[
'send_
post'
],
argsdict
[
'workspace
'
])
if
argsdict
[
'send_
ge
t'
]:
data
=
send_
ge
t
(
argsdict
[
'send_
get
'
])
pretty_print
(
data
)
if
argsdict
[
'delete_topic'
]:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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