We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3eed4fc commit 3c40d85Copy full SHA for 3c40d85
src/inferencesh/sdk.py
@@ -58,9 +58,16 @@ def _download_url(self) -> None:
58
tmp_file = tempfile.NamedTemporaryFile(delete=False, suffix=suffix)
59
self._tmp_path = tmp_file.name
60
61
+ # Set up request with user agent
62
+ headers = {
63
+ 'User-Agent': 'inference.sh'
64
+ }
65
+ req = urllib.request.Request(original_url, headers=headers)
66
+
67
# Download the file
68
print(f"Downloading URL: {original_url} to {self._tmp_path}")
- urllib.request.urlretrieve(original_url, self._tmp_path)
69
+ with urllib.request.urlopen(req) as response, open(self._tmp_path, 'wb') as out_file:
70
+ out_file.write(response.read())
71
self.path = self._tmp_path
72
73
def __del__(self):
0 commit comments