File system to handle connection with microsevice
Project description
filesystem-integration
Biblioteka służy do obsługi plików z mikroserwisu do twojego projektu.
Instalacja
Postaw kontenery z mikroserwisem https://github.com/gufi2115/Microservice-to-save-files
pip install filesystempack
Jak używać jeśli używasz DRF
W setttings.py dodaj:
INSTALLED_APPS = ["filesystempack.drf_filesystem"]
FILES_MICROSERVICE_URL = "http://host:6767/api/file/"
FILES_MICROSERVICE_API_KEY = API_KEY
W models.py:
from filesystempack.drf_filesystem.models import FileInfoM
class TwójModel(FileInfoM):
pass
W serializers.py:
from filesystempack.drf_filesystem.serializers import FileSerializer
class TwójSerializer(FileSerializer):
class Meta:
model = TwójModel
fields = FileSerializer.Meta.fields + ('twoje_pola')
read_only_fields = FileSerializer.Meta.read_only_fields + ('twoje_pola')
W views.py:
from filesystempack.drf_filesystem.views import FileViewSet
class TwójViewSet(FileViewSet):
queryset = TwójModel
serializer_class = TwójSerializer
Jak używać bez DRF
from filesystempack.filesystem import Filesystem
Storzenie instancji na przykład w helpers.py
file_system = Filesystem(url="http://host:6767/api/file/", api_key=twój_api_key_z_mikroserwisu)
POST
uuid = file_system.save_file(file=plik, content_type=mime_type_opcjonalnie)
GET
file, content_type = file_system.get_file(uuid)
DELETE
delete = file_system.delete_file(uuid)
status
status = file_system.status
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file filesystempack-1.1.2.tar.gz.
File metadata
- Download URL: filesystempack-1.1.2.tar.gz
- Upload date:
- Size: 560.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23467d8d95ab04aa7344dbb27bf021a3752895474e2c9aac5ecb6389fb2b197a
|
|
| MD5 |
f02d4a82b6241f13caf8df0e26247aa2
|
|
| BLAKE2b-256 |
8a0a100ad22a0376f23d7e084f0d1fbb0161eca48a9d78383aeb579b3da73230
|
File details
Details for the file filesystempack-1.1.2-py3-none-any.whl.
File metadata
- Download URL: filesystempack-1.1.2-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9cb4b00ebfe15ba0d60318dd0429a40c16ca2328e542c4dc0c11b20535946d16
|
|
| MD5 |
332b04a00d3816b0721b58cdb9287112
|
|
| BLAKE2b-256 |
8447111c4749e18467dfd471147f7c1883017f382c6e82df5fddbb038b907b2f
|