get_kerberos.py 574 B

12345678910111213141516
  1. from configs.logging import logger
  2. import os
  3. from app.common.minio import minio_client
  4. def get_kerberos_to_local(uri: str):
  5. file_name = uri.split("/")[-1]
  6. kerberos_exists = os.path.exists('./assets/kerberos')
  7. if not kerberos_exists:
  8. os.makedirs('./assets/kerberos')
  9. f_exists = os.path.exists('./assets/kerberos/'+file_name)
  10. if not f_exists:
  11. res = minio_client.get_file(uri)
  12. with open('./assets/kerberos/'+file_name,'wb') as f:
  13. f.write(res)
  14. logger.info(f'{file_name}不存在, 已通过minio下载至本地')