refactor: one retrying fetch loop in core.upstream

fetch_bytes and fetch_body now share open_retrying and read_limited:
scrapers retry a 500 or a dropped connection like profile_sync, and
fetch_body caps the body it reads.
This commit is contained in:
Abdessamad Derraz committed 2026-11-21 06:00:20 +01:00
1 parent 75b5fb987e
commit fdd7595a71
5 files changed
+145 -92

No files matched your search

+2 -2
View File
@@ -915,7 +915,7 @@ class TheGitHubTokenComesFromGh(unittest.TestCase):
with self._gh():
self.assertEqual(
upstream._headers("https://api.github.com/repos/o/n")["Authorization"],
upstream.forge_headers("https://api.github.com/repos/o/n")["Authorization"],
"Bearer gho_fromgh",
)
os.environ.pop("GITHUB_TOKEN")
@@ -930,7 +930,7 @@ class TheGitHubTokenComesFromGh(unittest.TestCase):
from core import upstream
with self._gh() as run:
headers = upstream._headers("https://gitlab.com/api/v4/projects/1")
headers = upstream.forge_headers("https://gitlab.com/api/v4/projects/1")
self.assertNotIn("Authorization", headers)
run.assert_not_called()