def _prepare_file_data(self, file_path):
with open(file_path, "rb") as file_artifact:
filename = os.path.basename(file_path)
mime = magic.Magic(mime=True).from_file(file_path)
encoded_string = base64.b64encode(file_artifact.read())
return "{};{};{}".format(filename, mime, encoded_string.decode())
评论列表
文章目录