2023-09-20 10:35:37 +03:00
|
|
|
from multiprocessing import get_logger
|
|
|
|
|
|
|
|
from models import get_supabase_client
|
|
|
|
from supabase.client import Client
|
|
|
|
|
|
|
|
logger = get_logger()
|
|
|
|
|
2023-12-13 01:16:32 +03:00
|
|
|
SIGNED_URL_EXPIRATION_PERIOD_IN_SECONDS = 3600
|
2023-09-20 10:35:37 +03:00
|
|
|
|
|
|
|
|
|
|
|
def generate_file_signed_url(path):
|
|
|
|
supabase_client: Client = get_supabase_client()
|
|
|
|
|
|
|
|
try:
|
|
|
|
response = supabase_client.storage.from_("quivr").create_signed_url(
|
2023-09-22 17:06:04 +03:00
|
|
|
path,
|
|
|
|
SIGNED_URL_EXPIRATION_PERIOD_IN_SECONDS,
|
|
|
|
options={
|
|
|
|
"download": True,
|
|
|
|
"transform": None,
|
|
|
|
},
|
2023-09-20 10:35:37 +03:00
|
|
|
)
|
|
|
|
logger.info("RESPONSE SIGNED URL", response)
|
|
|
|
return response
|
|
|
|
except Exception as e:
|
|
|
|
logger.error(e)
|