-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudSave.py
33 lines (28 loc) · 919 Bytes
/
cloudSave.py
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
30
31
32
33
from io import BytesIO
from minio import Minio
def load_csv(filename):
client = Minio("minio.101100.ca",
access_key="uyBquJD1wBqebVcMhIgq",
secret_key="ZGa6YUerybM1Jd0NPYugZhTnPhbtb48cZLiFuKYo",
)
try:
response = client.get_object("scouting-xtreme", filename)
return response.data.decode("utf-8")
except:
print("Failed to upload")
finally:
response.close()
response.release_conn()
def save_csv(filename, csv_string):
client = Minio("minio.101100.ca",
access_key="uyBquJD1wBqebVcMhIgq",
secret_key="ZGa6YUerybM1Jd0NPYugZhTnPhbtb48cZLiFuKYo",
)
csv_bytes = csv_string.encode('utf-8')
try:
result = client.put_object(
"scouting-xtreme", filename, BytesIO(csv_bytes), len(csv_bytes),
content_type="application/csv",
)
except:
print("Failed to download")