Skip to main content

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

Project description

django-s3-file-field-client

PyPI

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

Installation

pip install django-s3-file-field-client

Usage

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
)
with open('/path/to/my_file.txt', 'rb') as file_stream:  # Open in binary mode
    field_value = s3ff_client.upload_file(
        file_stream,  # This can be any file-like object
        'my_file.txt',
        '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 
    }
)

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

django-s3-file-field-client-0.2.0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file django-s3-file-field-client-0.2.0.tar.gz.

File metadata

  • Download URL: django-s3-file-field-client-0.2.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6

File hashes

Hashes for django-s3-file-field-client-0.2.0.tar.gz
Algorithm Hash digest
SHA256 15de0cbd867737b27b6ffe61e4deb0f36bdbc510a5466702c3717436a7f6d75d
MD5 db899500062cfb3f0b7b5911d54dc62d
BLAKE2b-256 fc7c821baa422e068cd8feb4adc6b27c16647d67b9ab4edec1a481569a648c03

See more details on using hashes here.

File details

Details for the file django_s3_file_field_client-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: django_s3_file_field_client-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6

File hashes

Hashes for django_s3_file_field_client-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f0f06ae1e52967566713a93b95a7bede6bc1520b286299abbd98c6d7fa9e114e
MD5 216c84fa024a38fcc8bb26f301539963
BLAKE2b-256 65823a031cc6caaa95800adeeea1d5e1ea2598b56a8d9d6ef75a69715f6f72df

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page