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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd7414b66f06239d888c7747f94980b6f946d3645fbd2042a4dc41d8ffc64215 |
|
MD5 | ed769292ff65ca763197591c76db28d8 |
|
BLAKE2b-256 | e6133c0d5413ffbd43484d02ff2012e1ba3a4602cfdd4784e5bf14701495edc9 |
Close
Hashes for django_s3_file_field_client-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24fc0997c6a289e5a99464c22eb0e883720380421dba2949a261f53303a87e19 |
|
MD5 | d6a621e1298346299fa5221f2deaf051 |
|
BLAKE2b-256 | e361793dadfa88739161006b7d1a39971610f2e49842b7b8f905c3f639522476 |