Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sebastian Schrader
Kea
Commits
b929be82
Commit
b929be82
authored
Jan 17, 2011
by
Jelte Jansen
Browse files
Merge branch 'trac431'
parents
c98ce872
345b8170
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/bin/bindctl/bindcmd.py
View file @
b929be82
...
...
@@ -217,16 +217,24 @@ class BindCmdInterpreter(Cmd):
for
module_name
in
self
.
config_data
.
get_config_item_list
():
self
.
_prepare_module_commands
(
self
.
config_data
.
get_module_spec
(
module_name
))
def
_send_message
(
self
,
url
,
body
):
headers
=
{
"cookie"
:
self
.
session_id
}
self
.
conn
.
request
(
'GET'
,
url
,
body
,
headers
)
res
=
self
.
conn
.
getresponse
()
return
res
.
status
,
res
.
read
()
def
send_GET
(
self
,
url
,
body
=
None
):
'''Send GET request to cmdctl, session id is send with the name
'cookie' in header.
'''
headers
=
{
"cookie"
:
self
.
session_id
}
self
.
conn
.
request
(
'GET'
,
url
,
body
,
headers
)
res
=
self
.
conn
.
getresponse
()
reply_msg
=
res
.
read
()
status
,
reply_msg
=
self
.
_send_message
(
url
,
body
)
if
status
==
http
.
client
.
UNAUTHORIZED
:
if
self
.
login_to_cmdctl
():
# successful, so try send again
status
,
reply_msg
=
self
.
_send_message
(
url
,
body
)
if
reply_msg
:
return
json
.
loads
(
reply_msg
.
decode
())
return
json
.
loads
(
reply_msg
.
decode
())
else
:
return
{}
...
...
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