Skip to main content

File system to handle connection with microsevice

Project description

filesystem-integration

The package was created to facilitate integration with a microservice.

Installation

Run microservice

https://github.com/gufi2115/Microservice-to-save-files

https://gufi2115.github.io/file-system-microservice-docs/

pip install filesystempack

How to use with DRF

In setttings.py add:

INSTALLED_APPS = ["filesystempack.drf_filesystem"]
FILES_MICROSERVICE_URL = "http://host:6767/api/file/"
FILES_MICROSERVICE_API_KEY = API_KEY

In models.py:

from filesystempack.drf_filesystem.models import FileInfoM

class YourModel(FileInfoM):
    pass

In serializers.py:

from filesystempack.drf_filesystem.serializers import FileSerializer

class YourSerializer(FileSerializer):
    class Meta:
        model = YourModel
        fields = FileSerializer.Meta.fields + ('yours_fields')
        read_only_fields = FileSerializer.Meta.read_only_fields + ('yours_fields')

In views.py:

from filesystempack.drf_filesystem.views import FileViewSet

class YourViewSet(FileViewSet):
    queryset = YourModel.objects.all()
    serializer_class = YourSerializer

How to use without DRF

from filesystempack.filesystem import Filesystem

Create class instance

file_system = Filesystem(url="http://host:6767/api/file/", api_key=API_KEY)

POST

uuid = file_system.save_file(file=plik, content_type=MIME_type)

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.6.tar.gz (560.2 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.6-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: filesystempack-1.1.6.tar.gz
  • Upload date:
  • Size: 560.2 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.6.tar.gz
Algorithm Hash digest
SHA256 6dc3bb5bcd41cdb8434e87b45d6722e847ad77ac1a17c7b9b1f682cbd1e09b33
MD5 1d0f7dc14faa9cff02276cb28a0e0452
BLAKE2b-256 c91a52a033dabed400b5f5224fb1c9182c5d06a28eb93a138adeb8dd779904ab

See more details on using hashes here.

File details

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

File metadata

  • Download URL: filesystempack-1.1.6-py3-none-any.whl
  • Upload date:
  • Size: 5.1 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b5e4fd51d85267ca6a5f1fc2270ebbea744d4db776584933e87326d7456c753f
MD5 8e8e6f37173640311dfd88513a2567bd
BLAKE2b-256 4420020a71dc7f9c658c342159bf727c49330532015dcec13b422e6e45bb95e6

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