A Python client library for django-s3-file-field.
Project description
django-s3-file-field-client
A Python client library for django-s3-file-field.
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') as file_stream:
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for django-s3-file-field-client-0.0.21.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 134a44a1bd2dd2f387dd4a01644cac697bbd60cd8f8ac6358b703c71d8b62f60 |
|
MD5 | 8ee66cba00b03e7fd389465525e2db4b |
|
BLAKE2b-256 | 62364801bf9592ccea9702f144b051c5dea70b147bb7df3ea90968f29cd6d519 |
Close
Hashes for django_s3_file_field_client-0.0.21-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 746fe73b8c662bac59cabe4ae4795872b8b123bd132dfe7c8cc910dbfff5669a |
|
MD5 | c6232aecdbd433c62457c0d54979b9b4 |
|
BLAKE2b-256 | 9025cff06785adb721fab3ec5eeba70af05c7c6550a0c886550c98ed0aef718f |