summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--matweb/oas/download.yml33
-rw-r--r--matweb/rest_api.py1
2 files changed, 34 insertions, 0 deletions
diff --git a/matweb/oas/download.yml b/matweb/oas/download.yml
new file mode 100644
index 0000000..4c101a4
--- /dev/null
+++ b/matweb/oas/download.yml
@@ -0,0 +1,33 @@
1---
2tags:
3 - "File Download"
4summary: 'Download a single cleaned file or zip archive containing multiple files'
5consumes:
6 - "application/json"
7produces:
8 - "*/*"
9parameters:
10- name: "key"
11 in: "path"
12 description: "A key generated for that resource"
13 required: true
14 type: "string"
15- name: "secret"
16 in: "path"
17 description: "A secret generated for that resource"
18 required: true
19 type: "string"
20- name: "filename"
21 in: "path"
22 description: "the filename of the cleaned file"
23 required: true
24 type: "string"
25
26
27responses:
28 200:
29 description: "An object containing all info about the cleaned file"
30 schema:
31 $ref: '#/definitions/UploadResponse'
32 404:
33 description: "The filename, key or secret are wrong" \ No newline at end of file
diff --git a/matweb/rest_api.py b/matweb/rest_api.py
index 4aeaa62..20ec155 100644
--- a/matweb/rest_api.py
+++ b/matweb/rest_api.py
@@ -72,6 +72,7 @@ class APIDownload(Resource):
72 def __init__(self, **kwargs): 72 def __init__(self, **kwargs):
73 self.upload_folder = kwargs['upload_folder'] 73 self.upload_folder = kwargs['upload_folder']
74 74
75 @swag_from('./oas/download.yml')
75 def get(self, key: str, secret: str, filename: str): 76 def get(self, key: str, secret: str, filename: str):
76 complete_path, filepath = utils.is_valid_api_download_file(filename, key, secret, self.upload_folder) 77 complete_path, filepath = utils.is_valid_api_download_file(filename, key, secret, self.upload_folder)
77 # Make sure the file is NOT deleted on HEAD requests 78 # Make sure the file is NOT deleted on HEAD requests