documented download endpoint

This commit is contained in:
Jan Friedli 2020-07-13 08:14:47 +02:00
parent 6aa9fa7029
commit 2c1bc2f05a
No known key found for this signature in database
GPG Key ID: F945FA2FCA30549D
2 changed files with 34 additions and 0 deletions

33
matweb/oas/download.yml Normal file
View File

@ -0,0 +1,33 @@
---
tags:
- "File Download"
summary: 'Download a single cleaned file or zip archive containing multiple files'
consumes:
- "application/json"
produces:
- "*/*"
parameters:
- name: "key"
in: "path"
description: "A key generated for that resource"
required: true
type: "string"
- name: "secret"
in: "path"
description: "A secret generated for that resource"
required: true
type: "string"
- name: "filename"
in: "path"
description: "the filename of the cleaned file"
required: true
type: "string"
responses:
200:
description: "An object containing all info about the cleaned file"
schema:
$ref: '#/definitions/UploadResponse'
404:
description: "The filename, key or secret are wrong"

View File

@ -72,6 +72,7 @@ class APIDownload(Resource):
def __init__(self, **kwargs):
self.upload_folder = kwargs['upload_folder']
@swag_from('./oas/download.yml')
def get(self, key: str, secret: str, filename: str):
complete_path, filepath = utils.is_valid_api_download_file(filename, key, secret, self.upload_folder)
# Make sure the file is NOT deleted on HEAD requests