Skip to main content

File system to handle connection with microsevice

Project description

filesystem-integration

Paczka powstała aby ułatwić integrację z mikroserwisem

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.4.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.4-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: filesystempack-1.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 b54eebbd902e4724d3c351aa879778eca7664de4848c5c0d224ef361540f06e7
MD5 77cddd88b77e69b1f828aad9da0c22b9
BLAKE2b-256 492ba30f6bcb1bd3ea1e8900ce5c0ae936edfd362dfb1050ac936cc8d84f4b4a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: filesystempack-1.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c789a936723db194c7971063629b1ba08ec421c2b16b814d32d6dd9e8ddb92ed
MD5 5942173b247d8ad6a015415063a2eb62
BLAKE2b-256 d9745f164e763278fe630ae721986c6ded2d04f6353df3e12a2dbdd9d61550e3

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