Skip to main content

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

filesystempack-1.1.1.tar.gz (560.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

filesystempack-1.1.1-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file filesystempack-1.1.1.tar.gz.

File metadata

  • Download URL: filesystempack-1.1.1.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

Hashes for filesystempack-1.1.1.tar.gz
Algorithm Hash digest
SHA256 f93f50261a5521524cef36e0edbf21af367a28d2865c2eb45f664f6dd698d4be
MD5 4efc7403592b5cdccfa28d3e23836157
BLAKE2b-256 c7f76d37b5ca3da4c325db024bec707a0a5f04486f5bb12786e999d0f3d49ae1

See more details on using hashes here.

File details

Details for the file filesystempack-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: filesystempack-1.1.1-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

Hashes for filesystempack-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 460a83ae1ba1a56a1569a5aa8b54b91b91302b98a248e8898818b4a2bc816433
MD5 dad7374c32bdd3c78d92cef3672aa30a
BLAKE2b-256 99f336f82a1f8ecd916ebf39a73427e9f9d7e6187338304b379b0adb7a387b96

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page