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):
80
80
empty DataFrame if the download fails.
81
81
"""
82
82
83
- def fetch_and_load_csv (url , file_path ):
83
+ def fetch_and_load_csv (url , file_path , overwrite = False ):
84
84
"""Helper function to download and load a TSV file as a DataFrame."""
85
85
try :
86
+ if overwrite :
87
+ return None
86
88
response = requests .get (url )
87
89
if response .status_code == 200 :
88
90
with open (file_path , "wb" ) as file :
@@ -106,7 +108,7 @@ def fetch_and_load_csv(url, file_path):
106
108
elif option == "detailed" :
107
109
url = "https://download.brainimagelibrary.org/inventory/daily/reports/today.tsv"
108
110
file_path = "/tmp/today.tsv"
109
- df = fetch_and_load_csv (url , file_path )
111
+ df = fetch_and_load_csv (url , file_path , overwrite )
110
112
if df is None :
111
113
print ("Failed to fetch detailed daily report. Returning empty DataFrame..." )
112
114
df = pd .DataFrame ()
You can’t perform that action at this time.
0 commit comments