django-s3-file-field-client
A Python client library for django-s3-file-field.
Installation
pip install django-s3-file-field-client
Usage
import mimetypes
import pathlib
import requests
from s3_file_field_client import S3FileFieldClient
file_to_upload = pathlib.Path("/path/to/my_file.txt")
with (
S3FileFieldClient(
"http://localhost:8000/api/v1/s3-upload/", # The path mounted in urlpatterns
headers={"Authorization": "Token ..."}, # Headers for the API's requests; optional
) as s3ff_client,
file_to_upload.open("rb") as file_stream, # Open in binary mode
):
field_value = s3ff_client.upload_file(
file_stream=file_stream, # This can be any seekable file-like object
file_name=file_to_upload.name,
file_content_type=mimetypes.guess_type(file_to_upload)[0],
field_id="core.File.blob", # The "<app>.<model>.<field>" to upload to
)
requests.post(
"http://localhost:8000/api/v1/file/", # This is particular to the application
headers={"Authorization": "Token ..."},
json={
"blob": field_value, # This should match the field uploaded to (e.g. 'core.File.blob')
...: ..., # Other fields for the POST request
},
)
Errors
A failed upload raises an S3FileFieldError, whose message is suitable for display. Its status
is the HTTP status of the response, if one was received, and its __cause__ is the underlying
requests exception, when there is one.
Metadata
Release files for django-s3-file-field-client 2.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_s3_file_field_client-2.0.1.tar.gz | 8.5 kB | Without provenance | Details for django_s3_file_field_client-2.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_s3_file_field_client-2.0.1-py3-none-any.whl | Python 3 | none | any | Details for django_s3_file_field_client-2.0.1-py3-none-any.whl |
Total release size: 16.2 kB
Release files / django_s3_file_field_client-2.0.1.tar.gz
| Download URL | django_s3_file_field_client-2.0.1.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bf058bfc4899a5017b5d1ea86ad07463cc98cf4925770e87ae188c55a34d6b6d
|
|
BLAKE2b-256 checksum How to use checksums |
31ed529b4e69fb9e60d094912308380c0582de8d3d3010222b4368713fb148fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / django_s3_file_field_client-2.0.1-py3-none-any.whl
| Download URL | django_s3_file_field_client-2.0.1-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f4b36310f78f364dc6d1f2b1e7f33e97601055b18534fe25dd7fd7570b359b2d
|
|
BLAKE2b-256 checksum How to use checksums |
063d7cae01784429c1b1b8685c7b6e84bc00f1d2246abde38bbe740f0aad6563
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for django-s3-file-field-client 2.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.