Skip to content

Commit

Permalink
Fix httpx usage
Browse files Browse the repository at this point in the history
Follow redirects when downloading from GitHub via httpx.
Fixes issue #686 [1].

[1]: #686

Reported-by: Antonio Petricca <antonio.petricca@gmail.com>
  • Loading branch information
claui committed Dec 2, 2022
1 parent a0cbfaa commit 987eb96
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 48 deletions.
81 changes: 36 additions & 45 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ include = ["LICENSE", "spleeter/resources/*.json"]
python = ">=3.7.1,<3.11"
ffmpeg-python = "0.2.0"
norbert = "0.2.1"
httpx = {extras = ["http2"], version = "^0.19.0"}
httpx = {extras = ["http2"], version = "^0.23.1"}
typer = "^0.3.2"
librosa = "^0.8.0"
musdb = {version = "0.3.1", optional = true}
Expand Down
4 changes: 2 additions & 2 deletions spleeter/model/provider/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def checksum(self, name: str) -> str:
self.CHECKSUM_INDEX,
)
)
response: httpx.Response = httpx.get(url)
response: httpx.Response = httpx.get(url, follow_redirects=True)
response.raise_for_status()
index: Dict = response.json()
if name not in index:
Expand All @@ -137,7 +137,7 @@ def download(self, name: str, path: str) -> None:
url = f"{url}.tar.gz"
logger.info(f"Downloading model archive {url}")
with httpx.Client(http2=True) as client:
with client.stream("GET", url) as response:
with client.stream("GET", url, follow_redirects=True) as response:
response.raise_for_status()
archive = NamedTemporaryFile(delete=False)
try:
Expand Down

0 comments on commit 987eb96

Please sign in to comment.