Mercurial > repos > jay > gaiac_regression_plot
view gaiac_pm_data_pulling/datapulling.py @ 1:9d28091f26dd draft
planemo upload for repository https://github.com/jaidevjoshi83/gaiac.git commit a733fec1915a1f6cf5f07092dc33426f765b6cb3-dirty
author | jay |
---|---|
date | Thu, 15 May 2025 22:50:33 +0000 |
parents | |
children |
line wrap: on
line source
import requests import sys def download_files_from_server(urls): """ Function to download files from a FastAPI server. Args: ip (str): The IP address of the FastAPI server. file_names (list): List of file names to download. Returns: None """ for url in urls: file_name = url.split('/')[len(url.split('/'))-1] response = requests.get(url) if response.status_code == 200: with open(f"{file_name}", "wb") as f: f.write(response.content) print(f"File {file_name} downloaded successfully!") else: print(f"Failed to download {file_name}. Status code: {response.status_code}") if __name__=="__main__": if len(sys.argv) > 1: files = sys.argv[1].split(',') download_files_from_server( files)