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.
Installation
pip install django-s3-file-field-client
Usage
import mimetypes
import pathlib
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
)
file_to_upload = pathlib.Path('/path/to/my_file.txt')
with 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 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
)
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_s3_file_field_client-1.1.0.tar.gz.
File metadata
- Download URL: django_s3_file_field_client-1.1.0.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7313b1e5147b3aa199916586daf07c82ef93dc3aef44e539c311efa2b1edd518
|
|
| MD5 |
670552f9572779624774e052ea2296e0
|
|
| BLAKE2b-256 |
6f0051a13a70b0fde0b58b0bf3ca53adc23a7e4fc179791aa56856bd3244a34c
|
Provenance
The following attestation bundles were made for django_s3_file_field_client-1.1.0.tar.gz:
Publisher:
release.yml on kitware-resonant/django-s3-file-field
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_s3_file_field_client-1.1.0.tar.gz -
Subject digest:
7313b1e5147b3aa199916586daf07c82ef93dc3aef44e539c311efa2b1edd518 - Sigstore transparency entry: 225704043
- Sigstore integration time:
-
Permalink:
kitware-resonant/django-s3-file-field@4a648d13e924a36b9ec4b4c68ea2873fc66e769c -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/kitware-resonant
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4a648d13e924a36b9ec4b4c68ea2873fc66e769c -
Trigger Event:
release
-
Statement type:
File details
Details for the file django_s3_file_field_client-1.1.0-py3-none-any.whl.
File metadata
- Download URL: django_s3_file_field_client-1.1.0-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a44512995ff69c2f687d31bed3d92f340123b56930de32e78f9db671b39faf64
|
|
| MD5 |
47768fa30b4cdad0f83d4dcfa78f011f
|
|
| BLAKE2b-256 |
608819b97746251647fd1287d58a013647a3ed03ab6c6e2d7bf26fd13c2a287a
|
Provenance
The following attestation bundles were made for django_s3_file_field_client-1.1.0-py3-none-any.whl:
Publisher:
release.yml on kitware-resonant/django-s3-file-field
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_s3_file_field_client-1.1.0-py3-none-any.whl -
Subject digest:
a44512995ff69c2f687d31bed3d92f340123b56930de32e78f9db671b39faf64 - Sigstore transparency entry: 225704066
- Sigstore integration time:
-
Permalink:
kitware-resonant/django-s3-file-field@4a648d13e924a36b9ec4b4c68ea2873fc66e769c -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/kitware-resonant
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4a648d13e924a36b9ec4b4c68ea2873fc66e769c -
Trigger Event:
release
-
Statement type: