From dd14b96c26f56ef38e7dc1146227555651efe702 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Fri, 14 Apr 2023 15:51:08 -0400 Subject: [PATCH] fix: follow redirects for moved repos --- README.rst | 3 +++ src/watchgha/utils.py | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 6f10ce6..e5175eb 100644 --- a/README.rst +++ b/README.rst @@ -122,6 +122,9 @@ Unreleased - Requests to GitHub are now made asynchronously, speeding execution. +- Redirections from GitHub (for example, if a repo is renamed or moved) are + followed transparently. + - The exit code is now 1 if any runs failed, 0 if all were successful. - Long lines are no longer wrapped too short. diff --git a/src/watchgha/utils.py b/src/watchgha/utils.py index 54b1d09..745c1e5 100644 --- a/src/watchgha/utils.py +++ b/src/watchgha/utils.py @@ -67,7 +67,9 @@ async def get_data(self, url): async with httpx.AsyncClient() as client: for _ in range(3): try: - resp = await client.get(url, headers=self.headers, timeout=30) + resp = await client.get( + url, headers=self.headers, timeout=30, follow_redirects=True + ) except httpx.HTTPError as e: raise WatchGhaError(e) if resp.status_code not in self.RETRY_STATUS_CODES: