Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions helpers/supabaseClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,35 @@ def convert_dict(self,data):
return data
except Exception as e:
print(e)
raise Exception
raise Exception

def getStatsStorage(self, fileName):
return self.client.storage.from_("c4gt-github-profile").download(fileName)
def getStatsStorage(file_name,bucket_name):
try:
from minio import Minio
from minio.error import S3Error

# Set up MinIO client
ACCESS_KEY = os.getenv("MINIO_ACCESS_KEY")
SECRET_KEY = os.getenv("MINIO_SECRET_KEY")
MINIO_API_HOST = os.getenv("MINIO_API_HOST")
bucket_name = "c4gt-github-profile"

minio_client = Minio(
endpoint=MINIO_API_HOST,
access_key=ACCESS_KEY,
secret_key=SECRET_KEY,
secure=False
)

response = minio_client.get_object(bucket_name, file_name)
file_content = response.read()
response.close()
response.release_conn()
return file_content

except S3Error as exc:
print(f"Error occurred while retrieving '{file_name}':", exc)
return None


def logVCAction(self,user, action):
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ yarl==1.9.2
supabase==1.0.3
SQLAlchemy==2.0.32
psycopg2==2.9.9
minio==7.2.8