File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -80,9 +80,11 @@ def daily(option="simple", overwrite=False):
8080 empty DataFrame if the download fails.
8181 """
8282
83- def fetch_and_load_csv (url , file_path ):
83+ def fetch_and_load_csv (url , file_path , overwrite = False ):
8484 """Helper function to download and load a TSV file as a DataFrame."""
8585 try :
86+ if overwrite :
87+ return None
8688 response = requests .get (url )
8789 if response .status_code == 200 :
8890 with open (file_path , "wb" ) as file :
@@ -106,7 +108,7 @@ def fetch_and_load_csv(url, file_path):
106108 elif option == "detailed" :
107109 url = "https://download.brainimagelibrary.org/inventory/daily/reports/today.tsv"
108110 file_path = "/tmp/today.tsv"
109- df = fetch_and_load_csv (url , file_path )
111+ df = fetch_and_load_csv (url , file_path , overwrite )
110112 if df is None :
111113 print ("Failed to fetch detailed daily report. Returning empty DataFrame..." )
112114 df = pd .DataFrame ()
You can’t perform that action at this time.
0 commit comments