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.23.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5c5b210d0667d227e0751cb5e714b75c95069422e580e2cba155723e09a38cd |
|
MD5 | 8cc86cc54ea48145691e69de339afbda |
|
BLAKE2b-256 | 81d9d47ca5880585c268908663b7028b61676d21f761b453b771220113642d24 |
Close
Hashes for django_s3_file_field_client-0.0.23-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf8ddb782dd4856b6bc603150dc7560184f574a76d8592e47427d3b132f78bdd |
|
MD5 | 9e1f74b0977e5d2d82ad93a307673254 |
|
BLAKE2b-256 | 044a104ed226888b89a791c5fa87cc003b7bd27e347cb97a57cc3fa8973b7872 |