From 5a663b3f203e1bb35d19c3eb7929e71eb4451ca3 Mon Sep 17 00:00:00 2001 From: Luke Lombardi Date: Mon, 9 Jun 2025 10:29:18 -0700 Subject: [PATCH] add download file method --- .gitignore | 2 ++ pyproject.toml | 2 +- src/beam/client/client.py | 9 +++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 35777e3..5e916b9 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ __pycache__ .python-version .DS_Store .vscode/launch.json +.beta9ignore +.beamignore \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index c864420..74a7d98 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "beam-client" -version = "0.2.158" +version = "0.2.159" description = "" authors = ["beam.cloud "] packages = [ diff --git a/src/beam/client/client.py b/src/beam/client/client.py index 8c06ffb..b878fc7 100644 --- a/src/beam/client/client.py +++ b/src/beam/client/client.py @@ -98,5 +98,14 @@ def subscribe( deployment = self.get_deployment(identifier) return deployment.subscribe(input=input) + def download_file(self, url: str, local_path: str) -> bytes: + """Download a file from a URL.""" + + response = requests.get(url) + response.raise_for_status() + + with open(local_path, "wb") as f: + f.write(response.content) + def __del__(self) -> None: self._deployment_cache.clear()