From ee60968719185600e46ad0987c8ef6c5f2cdf869 Mon Sep 17 00:00:00 2001 From: mashehu Date: Fri, 19 Jan 2024 11:45:11 +0100 Subject: [PATCH 1/2] handle redirects more gracefully when polling the nf-core website --- nf_core/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nf_core/utils.py b/nf_core/utils.py index 10b21018d2..35bccec4e3 100644 --- a/nf_core/utils.py +++ b/nf_core/utils.py @@ -414,11 +414,14 @@ def poll_nfcore_web_api(api_url, post_data=None): except requests.exceptions.ConnectionError: raise AssertionError(f"Could not connect to URL: {api_url}") else: - if response.status_code != 200: + if response.status_code != 200 and response.status_code != 301: log.debug(f"Response content:\n{response.content}") raise AssertionError( f"Could not access remote API results: {api_url} (HTML {response.status_code} Error)" ) + # follow redirects + if response.status_code == 301: + return poll_nfcore_web_api(response.headers["Location"], post_data) try: web_response = json.loads(response.content) if "status" not in web_response: From 4a8f1d666c90e4a065ccc84957e6d6a4394c1fcc Mon Sep 17 00:00:00 2001 From: nf-core-bot Date: Fri, 19 Jan 2024 11:42:49 +0000 Subject: [PATCH 2/2] [automated] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e98986191..861db9ea24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ - Add new subcommand `nf-core tui`, which launches a TUI (terminal user interface) to intuitively explore the command line flags, built using [Trogon](https://github.com/Textualize/trogon) ([#2655](https://github.com/nf-core/tools/pull/2655)) - Update pre-commit hook astral-sh/ruff-pre-commit to v0.1.13 ([#2660](https://github.com/nf-core/tools/pull/2660)) - Update actions/cache action to v4 ([#2666](https://github.com/nf-core/tools/pull/2666)) +- Handle api redirects from the old site ([#2672](https://github.com/nf-core/tools/pull/2672)) # [v2.11.1 - Magnesium Dragon Patch](https://github.com/nf-core/tools/releases/tag/2.11) - [2023-12-20]