Metadata-Version: 2.4
Name: filesystempack
Version: 1.1.4
Summary: File system to handle connection with microsevice
Project-URL: Repository, https://github.com/gufi2115/filesystem-integration
Project-URL: Microservice_docs, https://gufi2115.github.io/file-system-microservice-docs/
Project-URL: Microservice_repository, https://github.com/gufi2115/Microservice-to-save-files
Author-email: buber2006xdd@gmail.com
License: MIT
Keywords: Connection,File handling,Microservice
Classifier: Programming Language :: Python
Requires-Python: >=3.10
Requires-Dist: django>=5.2.9
Requires-Dist: djangorestframework>=3.16.1
Requires-Dist: niquests
Requires-Dist: python-magic
Description-Content-Type: text/markdown

# 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:

```python
INSTALLED_APPS = ["filesystempack.drf_filesystem"]
```

```python
FILES_MICROSERVICE_URL = "http://host:6767/api/file/"
```

```python
FILES_MICROSERVICE_API_KEY = API_KEY
```

In models.py:
```python
from filesystempack.drf_filesystem.models import FileInfoM

class YourModel(FileInfoM):
    pass
```

In serializers.py:

```python
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:

```python
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``