Skip to content
GitLab
Explore
Sign in
Register
Commits on Source (2)
Use more Pythonic """ (over ''')
· 77337b2c
Chris Lamb
authored
May 16, 2018
77337b2c
Appease flake8.
· 6583a90f
Chris Lamb
authored
May 16, 2018
6583a90f
Hide whitespace changes
Inline
Side-by-side
schedule
View file @
6583a90f
...
...
@@ -12,9 +12,9 @@ from rblib.certs import Certs
def
whoami
():
'''
"""
debugging function: check whether auth succeed
'''
"""
certs
=
Certs
.
from_browser
()
with
certs
.
requests
()
as
req
:
res
=
req
.
get
(
"
https://nm.debian.org/api/whoami
"
)
...
...
@@ -28,11 +28,13 @@ def send_req(args):
ret
=
res
.
status_code
if
ret
==
retcodes
.
ok
:
print
(
'
Scheduling successful!
'
)
if
args
.
debug
:
print
(
res
.
text
)
if
args
.
debug
:
print
(
res
.
text
)
elif
ret
==
retcodes
.
bad
:
print
(
'
Validation error!
'
)
print
(
res
.
headers
[
'
X-Error-Message
'
])
if
args
.
debug
:
print
(
res
.
text
)
if
args
.
debug
:
print
(
res
.
text
)
elif
ret
==
520
:
print
(
'
Unknown error while scheduling, check the output below
'
)
print
(
res
.
text
)
...
...
@@ -49,7 +51,8 @@ if __name__ == '__main__':
)
parser
.
add_argument
(
'
-d
'
,
'
--debug
'
,
help
=
'
dump the text from the scheduler also when otherwise not needed.
'
,
help
=
'
dump the text from the scheduler also when otherwise
'
'
not needed.
'
,
action
=
'
store_true
'
,
)
args
,
remote_args
=
parser
.
parse_known_args
()
...
...