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.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9211f83ab2d46832714fa1d118e00d5cf37ddc3d0ec47afc4703f007abe0a4e |
|
MD5 | 6b831504a58c62b4c742060e3623c79e |
|
BLAKE2b-256 | 55954e9d1c34dfb955b7ad838eb8da8d19ae504db96f152ee03e8de78584c847 |
Close
Hashes for django_s3_file_field_client-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3aa9ca48f26556751d44510252cfa67b1f6359d9677608265980c49614ecfd1 |
|
MD5 | a8ed258a06decbc91aa66a14801a49e1 |
|
BLAKE2b-256 | ff8ac57284dd6221f89a3fdbcbe03f0d278d478fea28394de94c6115f234edcd |