#473 added the same helper to two files:
modules/cert_transparency.py def _http_failure(result, source, status_code)
modules/wayback.py def _http_failure(result, source, status_code)
Both map 429 and 503 to RATE_LIMITED with "try again later" and everything else to ERROR. Other modules still write that mapping inline (if r.status_code == 429: return annotate(result, RATE_LIMITED, ...)), and the wording differs in each one.
What to do:
- Move the helper into
modules/module_status.py as a public function, e.g. annotate_http_failure(result, source, status_code), and import it in both modules.
- Delete the two private copies.
- Add a test in
tests/test_module_status.py (create it if missing) for 429, 503 and 500.
Done when there is one copy of the helper and the existing cert_transparency and wayback tests still pass unchanged. Moving other modules onto it is not part of this issue.
#473 added the same helper to two files:
Both map 429 and 503 to
RATE_LIMITEDwith "try again later" and everything else toERROR. Other modules still write that mapping inline (if r.status_code == 429: return annotate(result, RATE_LIMITED, ...)), and the wording differs in each one.What to do:
modules/module_status.pyas a public function, e.g.annotate_http_failure(result, source, status_code), and import it in both modules.tests/test_module_status.py(create it if missing) for 429, 503 and 500.Done when there is one copy of the helper and the existing cert_transparency and wayback tests still pass unchanged. Moving other modules onto it is not part of this issue.