-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoutdated-backup.py
More file actions
29 lines (23 loc) · 932 Bytes
/
outdated-backup.py
File metadata and controls
29 lines (23 loc) · 932 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from datetime import datetime
from pathlib import Path
import numpy as np
import pandas as pd
import requests
###############################################################################################################
print(f"Processing summary metadata from brainimagelibrary.org")
url = "https://submit.brainimagelibrary.org/search/summarymetadata"
if Path("/bil/data/inventory").exists():
report_output_directory = "/bil/data/inventory/daily"
if not Path(report_output_directory).exists():
Path(report_output_directory).mkdir()
now = datetime.now()
report_output_filename = (
report_output_directory + "/" + str(now.strftime("%Y%m%d")) + ".csv"
)
temp_file = Path(report_output_filename)
if temp_file.exists():
temp_file.unlink()
response = requests.get(url)
temp_file.write_bytes(response.content)
else:
print("Path /bil/data/inventory does not exist.")