diff options
| author | Jan Friedli | 2020-05-15 14:38:13 +0200 |
|---|---|---|
| committer | Jan Friedli | 2020-05-15 14:38:13 +0200 |
| commit | 83618ff529dbd8e8b89a51e54a7d81eab7dd823b (patch) | |
| tree | b5b88ec536a2e3928cc74038422935fe3abb3680 /matweb/utils.py | |
| parent | e75d9a7de5a083d983d0d682a48752f48df71eb2 (diff) | |
added new property which indicates the remaining download time in secs
Diffstat (limited to '')
| -rw-r--r-- | matweb/utils.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/matweb/utils.py b/matweb/utils.py index 20c213d..915d735 100644 --- a/matweb/utils.py +++ b/matweb/utils.py | |||
| @@ -35,6 +35,7 @@ def check_upload_folder(upload_folder): | |||
| 35 | 35 | ||
| 36 | 36 | ||
| 37 | def return_file_created_response( | 37 | def return_file_created_response( |
| 38 | inactive_after_sec: int, | ||
| 38 | output_filename: str, | 39 | output_filename: str, |
| 39 | mime: str, | 40 | mime: str, |
| 40 | key: str, | 41 | key: str, |
| @@ -44,6 +45,7 @@ def return_file_created_response( | |||
| 44 | download_link: str | 45 | download_link: str |
| 45 | ) -> dict: | 46 | ) -> dict: |
| 46 | return { | 47 | return { |
| 48 | 'inactive_after_sec': inactive_after_sec, | ||
| 47 | 'output_filename': output_filename, | 49 | 'output_filename': output_filename, |
| 48 | 'mime': mime, | 50 | 'mime': mime, |
| 49 | 'key': key, | 51 | 'key': key, |
| @@ -106,3 +108,7 @@ def is_valid_api_download_file(filename: str, key: str, secret: str, upload_fold | |||
| 106 | if hmac.compare_digest(hash_file(complete_path, secret), key) is False: | 108 | if hmac.compare_digest(hash_file(complete_path, secret), key) is False: |
| 107 | abort(400, message='The file hash does not match') | 109 | abort(400, message='The file hash does not match') |
| 108 | return complete_path, filepath | 110 | return complete_path, filepath |
| 111 | |||
| 112 | |||
| 113 | def get_file_removal_max_age_sec() -> int: | ||
| 114 | return int(os.environ.get('MAT2_MAX_FILE_AGE_FOR_REMOVAL', 15 * 60)) | ||
