Skip to content

Commit

Permalink
Merge pull request #2672 from mashehu/handle-api-redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
mashehu authored Jan 26, 2024
2 parents 011f3ac + 0b839f9 commit c11055b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
- Update pre-commit hook astral-sh/ruff-pre-commit to v0.1.13 ([#2660](https://github.com/nf-core/tools/pull/2660))
- Add new subcommand: `nf-core logo-create` to output an nf-core logo for a pipeline (instead of going through the website) ([#2662](https://github.com/nf-core/tools/pull/2662))
- 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))
- Remove redundanct v in pipeline version for emails ([#2667](https://github.com/nf-core/tools/pull/2667))

# [v2.11.1 - Magnesium Dragon Patch](https://github.com/nf-core/tools/releases/tag/2.11) - [2023-12-20]
Expand Down
5 changes: 4 additions & 1 deletion nf_core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,11 +420,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:
Expand Down

0 comments on commit c11055b

Please sign in to comment.