django-s3-file-field-client


Namedjango-s3-file-field-client JSON
Version 1.0.1 PyPI version JSON
download
home_pageNone
SummaryA Python client library for django-s3-file-field.
upload_time2024-03-22 04:32:56
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseApache 2.0
keywords django django-widget minio s3
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # django-s3-file-field-client
[![PyPI](https://img.shields.io/pypi/v/django-s3-file-field-client)](https://pypi.org/project/django-s3-file-field-client/)

A Python client library for django-s3-file-field.

## Installation
```bash
pip install django-s3-file-field-client
```

## Usage
```python
import mimetypes
import pathlib
import requests
from s3_file_field_client import S3FileFieldClient

api_client = requests.Session()  # This can be used to set authentication headers, etc.

s3ff_client = S3FileFieldClient(
    'http://localhost:8000/api/v1/s3-upload/',  # The path mounted in urlpatterns
    api_client,  # This argument is optional
)

file_to_upload = pathlib.Path('/path/to/my_file.txt')
with file_to_upload.open('rb') as file_stream:  # Open in binary mode
    field_value = s3ff_client.upload_file(
        file_stream=file_stream,  # This can be any file-like object
        file_name=file_to_upload.name,
        file_content_type=mimetypes.guess_type(file_to_upload)[0],
        field_id='core.File.blob',  # The "<app>.<model>.<field>" to upload to
    )

api_client.post(
    'http://localhost:8000/api/v1/file/',  # This is particular to the application
    json={
        'blob': field_value,  # This should match the field uploaded to (e.g. 'core.File.blob')
        ...: ...,   # Other fields for the POST request
    }
)
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "django-s3-file-field-client",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "\"Kitware, Inc.\" <kitware@kitware.com>",
    "keywords": "django, django-widget, minio, s3",
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/8b/c2/2a746134f26beadfcd099fe8b7574494858d0ded7979dec7c9e2ee1af544/django_s3_file_field_client-1.0.1.tar.gz",
    "platform": null,
    "description": "# django-s3-file-field-client\n[![PyPI](https://img.shields.io/pypi/v/django-s3-file-field-client)](https://pypi.org/project/django-s3-file-field-client/)\n\nA Python client library for django-s3-file-field.\n\n## Installation\n```bash\npip install django-s3-file-field-client\n```\n\n## Usage\n```python\nimport mimetypes\nimport pathlib\nimport requests\nfrom s3_file_field_client import S3FileFieldClient\n\napi_client = requests.Session()  # This can be used to set authentication headers, etc.\n\ns3ff_client = S3FileFieldClient(\n    'http://localhost:8000/api/v1/s3-upload/',  # The path mounted in urlpatterns\n    api_client,  # This argument is optional\n)\n\nfile_to_upload = pathlib.Path('/path/to/my_file.txt')\nwith file_to_upload.open('rb') as file_stream:  # Open in binary mode\n    field_value = s3ff_client.upload_file(\n        file_stream=file_stream,  # This can be any file-like object\n        file_name=file_to_upload.name,\n        file_content_type=mimetypes.guess_type(file_to_upload)[0],\n        field_id='core.File.blob',  # The \"<app>.<model>.<field>\" to upload to\n    )\n\napi_client.post(\n    'http://localhost:8000/api/v1/file/',  # This is particular to the application\n    json={\n        'blob': field_value,  # This should match the field uploaded to (e.g. 'core.File.blob')\n        ...: ...,   # Other fields for the POST request\n    }\n)\n```\n",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "A Python client library for django-s3-file-field.",
    "version": "1.0.1",
    "project_urls": {
        "Bug Reports": "https://github.com/girder/django-s3-file-field/issues",
        "Repository": "https://github.com/girder/django-s3-file-field"
    },
    "split_keywords": [
        "django",
        " django-widget",
        " minio",
        " s3"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c330edeec4725d1795dda41a580ce986cb8aa6879b25057c1e47c97894fe9966",
                "md5": "de8b94ad9c700bd838def085772cb55a",
                "sha256": "29f6fcd0bcf60020867ef8407af09fe96b97d8883a828ea2e04ac30981305163"
            },
            "downloads": -1,
            "filename": "django_s3_file_field_client-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "de8b94ad9c700bd838def085772cb55a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 3220,
            "upload_time": "2024-03-22T04:32:54",
            "upload_time_iso_8601": "2024-03-22T04:32:54.020762Z",
            "url": "https://files.pythonhosted.org/packages/c3/30/edeec4725d1795dda41a580ce986cb8aa6879b25057c1e47c97894fe9966/django_s3_file_field_client-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8bc22a746134f26beadfcd099fe8b7574494858d0ded7979dec7c9e2ee1af544",
                "md5": "5e57013e492e61f16481cc14d56c5b48",
                "sha256": "e5a2154d20556ce4603e89a0239c6bfea6d58c73d5e4df4a2d71d3deea787277"
            },
            "downloads": -1,
            "filename": "django_s3_file_field_client-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "5e57013e492e61f16481cc14d56c5b48",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 4634,
            "upload_time": "2024-03-22T04:32:56",
            "upload_time_iso_8601": "2024-03-22T04:32:56.939603Z",
            "url": "https://files.pythonhosted.org/packages/8b/c2/2a746134f26beadfcd099fe8b7574494858d0ded7979dec7c9e2ee1af544/django_s3_file_field_client-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-22 04:32:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "girder",
    "github_project": "django-s3-file-field",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "django-s3-file-field-client"
}
        
Elapsed time: 4.17386s