Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Hacksaar
Sphinx
Commits
67962c39
Commit
67962c39
authored
Mar 08, 2015
by
Ralf
Browse files
log successful SpaceAPI updates
parent
c04dff75
Changes
1
Hide whitespace changes
Inline
Side-by-side
spaceapi.py
View file @
67962c39
...
...
@@ -27,7 +27,9 @@ class SpaceApi:
url
=
"https://spaceapi.hacksaar.de/status.php?action=update&key=%s&status=%d"
%
(
spaceApiKey
,
state_val
)
response
=
urllib
.
request
.
urlopen
(
url
,
timeout
=
5.0
)
responseText
=
response
.
read
().
decode
(
'utf-8'
).
strip
()
if
response
.
getcode
()
==
200
and
responseText
==
"UpdateSuccessful"
:
return
True
if
response
.
getcode
()
==
200
and
responseText
==
"UpdateSuccessful"
:
logger
.
debug
(
"SpaceAPI: Update to {} successful"
.
format
(
state_val
))
return
True
logger
.
error
(
"SpaceAPI: returned unexpected code {}:
\n
{}"
.
format
(
response
.
getcode
(),
responseText
))
return
False
except
urllib
.
request
.
URLError
as
e
:
...
...
Write
Preview
Supports
Markdown
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