⚲
Project
General
Profile
Sign in
Home
Projects
Help
Search
:
openQA Project
All Projects
QA
»
openQA Project
Overview
Activity
Roadmap
Issues
Wiki
Download (776 Bytes)
action #94531
» filter_details.py
MDoucha
, 2021-06-30 13:07
#!/usr/bin/python3
import
re
import
requests
import
sys
from
urllib.parse
import
parse_qs
,
urlencode
,
urlparse
,
urlunparse
base_url
=
'
https://openqa.suse.de/api/v1/jobs/%s
'
def
fetch_url
(
url
):
response
=
requests
.
get
(
url
)
response
.
raise_for_status
()
return
response
.
json
()
def
filter_jobs
(
fr
):
for
line
in
fr
:
job_id
=
line
.
split
()[
0
]
try
:
data
=
fetch_url
(
base_url
%
job_id
)[
'
job
'
]
if
data
[
'
state
'
]
==
'
done
'
and
data
[
'
result
'
]
!=
'
incomplete
'
:
print
(
line
,
end
=
''
)
except
KeyboardInterrupt
:
return
except
:
print
(
'
Failed to query job %s result
'
%
job_id
,
file
=
sys
.
stderr
)
print
(
line
,
end
=
''
)
if
__name__
==
'
__main__
'
:
filter_jobs
(
sys
.
stdin
)
« Previous
1
2
3
4
…
6
Next »
(2-2/6)
Loading...