Skip to content

Commit 1844c5a

Browse files
authored
Update reports.py
1 parent 0b57e13 commit 1844c5a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

brainimagelibrary/reports.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff 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()

0 commit comments

Comments
 (0)