Skip to content

Commit 3a5735d

Browse files
committed
Fix httpx usage
Follow redirects when downloading from GitHub via httpx. Fixes issue #686 [1]. [1]: #686 Reported-by: Antonio Petricca <[email protected]>
1 parent 13c771b commit 3a5735d

File tree

3 files changed

+28
-20
lines changed

3 files changed

+28
-20
lines changed

poetry.lock

Lines changed: 25 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ include = ["LICENSE", "spleeter/resources/*.json"]
4747
[tool.poetry.dependencies]
4848
python = ">=3.7.1,<3.11"
4949
ffmpeg-python = "^0.2.0"
50-
httpx = {extras = ["http2"], version = "^0.19.0"}
50+
httpx = {extras = ["http2"], version = "^0.23.1"}
5151
typer = "^0.3.2"
5252
musdb = {version = "^0.4.0", optional = true}
5353
museval = {version = "^0.4.0", optional = true}

spleeter/model/provider/github.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def checksum(self, name: str) -> str:
121121
self.CHECKSUM_INDEX,
122122
)
123123
)
124-
response: httpx.Response = httpx.get(url)
124+
response: httpx.Response = httpx.get(url, follow_redirects=True)
125125
response.raise_for_status()
126126
index: Dict = response.json()
127127
if name not in index:
@@ -144,7 +144,7 @@ def download(self, name: str, path: str) -> None:
144144
url = f"{url}.tar.gz"
145145
logger.info(f"Downloading model archive {url}")
146146
with httpx.Client(http2=True) as client:
147-
with client.stream("GET", url) as response:
147+
with client.stream("GET", url, follow_redirects=True) as response:
148148
response.raise_for_status()
149149
archive = NamedTemporaryFile(delete=False)
150150
try:

0 commit comments

Comments
 (0)