Yediemin
A package for bulletproof attachment serving in Django Rest Framework.
Getting Started
Requirements
- Nginx
- Django Rest Framework
- Session Authentication
- Django Storages (S3)
Installation Steps
- Install package from PyPi.
pip install yediemin
- Add the view to
urls.py
from yediemin import YedieminView
urlpatterns = [
re_path(r'^yediemin/(?P<file_name>\S+)/$', YedieminView.as_view(), name='yediemin'),
]
- Configure Nginx. Place the configuration below under your server.
location /yediemin-files/ {
internal;
resolver 8.8.8.8;
set $redirect_uri "$upstream_http_redirect_uri";
proxy_buffering off;
proxy_pass $redirect_uri;
}
- Use
YedieminFileFieldin serializer forFileField.
from yediemin import YedieminFileField
class AttachmentSerializer(serializers.ModelSerializer):
file = YedieminFileField()
class Meta:
model = Attachment
fields = (
"id",
"file",
)
- Use
PrivateS3Boto3Storagefor the field inmodels.py
from yediemin import PrivateS3Boto3Storage
class Attachment(models.Model):
file = models.FileField(storage=PrivateS3Boto3Storage())
- Upload files to S3 with
YedieminFileField. Yediemin requires presigned object url.
Settings
YEDIEMIN_HIDDEN_REDIRECT_PATH
Default: yediemin-files.
It should be same with location in nginx configuration.
YEDIEMIN_AUTHENTICATION_CLASSES
Default: [rest_framework.authentication.SessionAuthentication]
YEDIEMIN_EXPIRE_IN
Default: 604800 seconds which is 1 week. This is the maximum limit provided by AWS. Using Query Parameters
Metadata
Release files for yediemin 0.2.0
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 |
|---|---|---|---|---|
| yediemin-0.2.0.tar.gz | 4.4 kB | Without provenance | Details for yediemin-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| yediemin-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for yediemin-0.2.0-py3-none-any.whl |
Total release size: 9.5 kB
Release files / yediemin-0.2.0.tar.gz
| Download URL | yediemin-0.2.0.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c0b49696149916e32c307d03f7924800351c7f932b2d99ae0220df216e0f45b9
|
|
BLAKE2b-256 checksum How to use checksums |
94e21a10ba6a712936e1c9c3029b487acd58344152fadf9b4bf1c4ff0e633645
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.5 CPython/2.7.16 Darwin/19.6.0
|
Release files / yediemin-0.2.0-py3-none-any.whl
| Download URL | yediemin-0.2.0-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aa757c011cbb62cf5b659179747a6e890b1bbe8381b58bc8cc541290488c6b6a
|
|
BLAKE2b-256 checksum How to use checksums |
b39258ec50501b50d8246b88e614544b961d0c6bc7885592de674240eed19f81
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.5 CPython/2.7.16 Darwin/19.6.0
|
Security for yediemin 0.2.0
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.