lint: tidying up code in block tasks

This commit is contained in:
Iain Learmonth 2022-06-17 12:42:42 +01:00
parent a0da4d4641
commit ac5a604587
8 changed files with 86 additions and 49 deletions

View file

@ -27,9 +27,9 @@ def _check_origin(api_url: str, result: Dict[str, Any]) -> Dict[str, Any]:
return result
for r in req['results']:
not_ok = False
for s in ["anomaly", "confirmed", "failure"]:
if s in r and r[s]:
result[r["probe_cc"]][s] += 1
for status in ["anomaly", "confirmed", "failure"]:
if status in r and r[status]:
result[r["probe_cc"]][status] += 1
not_ok = True
break
if not not_ok:
@ -60,6 +60,10 @@ def threshold_origin(domain_name: str) -> Dict[str, Any]:
class BlockOONIAutomation(BaseAutomation):
"""
Automation task to import origin and/or proxy reachability results from OONI.
"""
short_name = "block_ooni"
description = "Import origin and/or proxy reachability results from OONI"
frequency = 240