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

Uploaded Python 3

File details

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

File metadata

  • Download URL: filesystempack-1.1.5.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.5.tar.gz
Algorithm Hash digest
SHA256 97ded5626554922b2c90157d6ff68ca73e63e9c216fb6b8e3f7c480c82e55760
MD5 8e3f9d455efbdedac846658fa306a0d0
BLAKE2b-256 89f470eb9a775c0dad64b20732a89ca459e3586473a11cfc00d5a3b88987ffb4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: filesystempack-1.1.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 1c10c8577a66804cd3377acfee2afb9099f54e9483a1f044ac2f969e915a5409
MD5 51cf19ed0dc37abc73d4d928eb6f4276
BLAKE2b-256 3456c849783693b8537f5c5a34d8019fd168901548273b904d8bd49db01c1b4d

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