diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-01-11 13:47:48 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-01-11 13:47:48 +0100 |
| commit | 0b0b46eb096cce9eafe5e2d6f9bdb7902ff68874 (patch) | |
| tree | a42ebda1644877160835e78d41daa4c81f81cd81 | |
| parent | 1cda1678bf95559d60e6104fe0e9f9e8d8afb5f2 (diff) | |
mimetype?
| -rw-r--r-- | cli/app/utils/cortex_utils.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/cli/app/utils/cortex_utils.py b/cli/app/utils/cortex_utils.py index 0de9596..4aa4533 100644 --- a/cli/app/utils/cortex_utils.py +++ b/cli/app/utils/cortex_utils.py @@ -2,6 +2,7 @@ import os from os.path import join import requests import urllib3 +import mimetypes urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) from app.settings import app_cfg @@ -96,5 +97,7 @@ def upload_bytes_to_cortex(opt_folder_id, fn, fp, mimetype, **kwargs): def upload_file_to_cortex(opt_folder_id, fn, **kwargs): """Upload a file from disk""" + base_fn = os.path.basename(fn) + mimetype = mimetypes.guess_type(base_fn) with open(fn, 'rb') as fp: - return upload_fp_to_cortex(opt_folder_id, fp, **kwargs) + return upload_fp_to_cortex(opt_folder_id, (base_fn, fp, mimetype,), **kwargs) |
