No description
This repository has been archived on 2024-11-06. You can view files and clone it, but cannot push or open issues or pull requests.
Find a file
2023-04-23 16:12:16 +02:00
.drone.yml ci: test 2023-04-23 16:12:16 +02:00
app.py add healthcheck 2023-04-14 12:17:08 +02:00
docker-compose.yml add docs 2023-04-13 14:50:46 +02:00
Dockerfile add healthcheck 2023-04-14 12:17:08 +02:00
gunicorn_config.py test logging 2023-04-13 15:18:23 +02:00
README.md add docs + test 2023-04-14 12:20:04 +02:00
requirements.txt add gunicorn 2023-04-13 14:53:55 +02:00
tests.sh add docs + test 2023-04-14 12:20:04 +02:00

python-api-server

a small flask-application for storing and downloading stuff like small binaries

Variables

  • MAX_CONTENT_LENGTH: maximal Filesize in MB; defaults to 5MB
  • UPLOAD_DIRECTORY: where to store the uploaded files; should be mapped to a volume; defaults to "/uploads"
  • AUTH_TOKEN: token used for authenticating

Example Docker-Compose

see docker-compose.yml

API-Endpoints

/list

input

curl -H "token: myuploadtoken" http://docker10.host.lan:5040/list | jq

output

{
  "files": [
    {
      "last_modified": "2023-04-13 11:43:51",
      "name": "file1",
      "size": 1034
    },
    {
      "last_modified": "2023-04-13 11:53:59",
      "name": "file2",
      "size": 5
    },
    {
      "last_modified": "2023-04-13 12:41:18",
      "name": "file3",
      "size": 3478
    }
  ]
}

/upload

If a existing file has the same name as the newly uploaded file, it will be overwritten.

input

curl -X POST -H "token: myuploadtoken" -F "file=@tests/file" http://docker10.host.lan:5040/upload | jq

output

{
  "success": "File 'file' successfully uploaded"
}

/download

input

wget http://docker10.host.lan:5040/download/file

/delete

input

curl -X DELETE -H "token: myuploadtoken" http://docker10.host.lan:5040/delete/file | jq

output

{
  "success": "File 'file' successfully deleted"
}

/health

input

curl http://docker10.host.lan:5040/health

output

OK