dobby-storage
https://github.com/Ting-Yu/dobby-storage.git
S3 Information
- CUSTOM_AWS_ACCESS_KEY_ID
- CUSTOM_AWS_SECRET_ACCESS_KEY
- CUSTOM_AWS_DEFAULT_REGION
- CUSTOM_AWS_BUCKET
FTP Information
- CUSTOM_FTP_SERVER
- CUSTOM_FTP_USER
- CUSTOM_FTP_PASSWORD
Google Drive Information
- CUSTOM_GOOGLE_DRIVE_AUTH_PATH
Install Module
pip install dobby-storage
Unit Test
pytest
Usage
from dobby_storage.storage import FileStorage
# if you want to use storage.json, please refer to dobby_storage/storage.json
# but I still recommend you to set it up in os system environment, the setting is as above, S3 Information, FTP Information, Google Drive Information
file_storage = FileStorage('storage.json')
# 1. Local storage
result = file_storage.save('upload_test.txt', 'destination.txt')
print(f"Local storage File {result}.")
# 2. Using S3 storage with upload_file
file_storage.use_disk('s3')
result = file_storage.save('upload_test.txt', 'destination.txt', bucket_name='fribooker')
print(f"S3 storage with upload_file File {result}.")
# 3. Using S3 storage with upload_fileobj
result = file_storage.save('upload_test.txt', 'destination.txt', bucket_name='fribooker', use_fileobj=True)
print(f"S3 storage with upload_fileobj File {result}.")
# 4. Using FTP storage
file_storage.use_disk('ftp')
result = file_storage.save('upload_test.txt', 'destination.txt')
print(f"FTP storage File {result}.")
# 5. Using Google Drive storage
file_storage.use_disk('google_drive')
result = file_storage.save('upload_test.txt')
print(f"Google Drive storage File {result}.")
Metadata
Release files for dobby-storage 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dobby_storage-1.0.2.tar.gz | 5.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dobby_storage-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.2 kB
Release files / dobby_storage-1.0.2.tar.gz
| Download URL | dobby_storage-1.0.2.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c39160acf1286106dd6b68e207bf0e1da52f714073626f6c271be5c88167326f
|
|
BLAKE2b-256 checksum How to use checksums |
a4bd25d4d74e92a10ab0a5efe4d5793e1a2b578a312829fab20693e11ad63f80
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.2
|
Release files / dobby_storage-1.0.2-py3-none-any.whl
| Download URL | dobby_storage-1.0.2-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a94adf5a41dd420937e88dfec0caf7fae5662c7c837a7c1bb0a44cdb23ba64a6
|
|
BLAKE2b-256 checksum How to use checksums |
22ea5eb1d8b06ebfc16b9872b3c2980047b703c22b76d3b4e30425145b45f151
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.2
|