A python library to upload files on cloud. Supported services - AWS S3, DigitalOcean Spaces, LocalStorage.
Project description
Storedoc
A python module to upload files on cloud. Supported services - AWS S3, DigitalOcean Spaces, LocalStorage.
Installation
To install, simply use pip or easy_install:
$ pip install --upgrade storedoc
or
$ easy_install --upgrade storedoc
Get Started
Upload to AWS S3 Buckets
Initialize the service
from storedoc import Service
client = Service('aws')
Get information of the service
client.describe()
Instantiate AWS S3 Client
client.connect(
region_name='//s3.your-region.amazonaws.com',
endpoint_url='https://s3.amazonaws.com',
aws_access_key_id='your-access-key',
aws_secret_access_key='your-secret'
)
Upload the file to S3 bucket (Note: File type supported <werkzeug.datastructures.FileStorage>)
# Default ACL (Access Control List) is set to 'private'.
# Default MIME Type results to 'binary/octet-stream' if no MIME type is provided.
client.upload_file(file, bucket='your-bucket-name')
# To add your custom ACL ('private'|'public-read'|'public-read-write'|'authenticated-read'|'aws-exe').
client.upload_file(file, bucket='your-bucket-name', acl='public-read')
# To add explicit MIME Type. Example for JPEG image upload, you can user
client.upload_file(file, bucket='your-bucket-name', mime='image/jpeg')
# You can let storedoc guess the MIME Type for you (Default is set to False)
client.upload_file(file, bucket='your-bucket-name', guess_mime=True)
Upload to DigitalOcean Spaces Buckets
Initialize the service
from storedoc import Service
client = Service('do')
Get information of the service
client.describe()
Instantiate DO Spaces Client
client.connect(
region_name='//s3.your-region.amazonaws.com',
endpoint_url='https://your-region.digitaloceanspaces.com',
aws_access_key_id='your-access-key',
aws_secret_access_key='your-secret'
)
Upload the file to S3 bucket (Note: File type supported <werkzeug.datastructures.FileStorage>)
# Default ACL (Access Control List) is set to 'private'.
# Default MIME Type results to 'binary/octet-stream' if no MIME type is provided.
client.upload_file(file, bucket='your-bucket-name')
# To add your custom ACL ('private'|'public-read'|'public-read-write'|'authenticated-read'|'aws-exe').
client.upload_file(file, bucket='your-bucket-name', acl='public-read')
# To add explicit MIME Type. Example for JPEG image upload, you can user
client.upload_file(file, bucket='your-bucket-name', mime='image/jpeg')
# You can let storedoc guess the MIME Type for you (Default is set to False)
client.upload_file(file, bucket='your-bucket-name', guess_mime=True)
Save File to Local Storage
Initialize the service
from storedoc import Service
client = LocalStorage()
Save file to working directory (Note: File type supported <werkzeug.datastructures.FileStorage>)
client.save_file(file)
Save file to specific directory (Note: File type supported <werkzeug.datastructures.FileStorage>)
client.save_file(file, folder='some-directory-name')
Features
- Upload Any file to AWS s3, DigitalOcean Spaces
- Set ACL Support
- Content Type Support
Third Party Libraries and Dependencies
The following libraries will be installed when you install the client library:
- boto3 (Amazon Web Services SDK for Python)
To-Dos
- Test cases.
Contribute
- Look for an open issue or create new issue to get a dialog going about the new feature or bug that you've discovered.
- Fork the repository on Github to start making your changes to the master branch (or branch off of it).
- Write a test which shows that the bug was fixed or that the feature works as expected.
- Make a pull 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 storedoc-0.1.8.tar.gz.
File metadata
- Download URL: storedoc-0.1.8.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
907e2055450a9fab171d1530073bd17b48874f3ec38a595e7b754bb8208046a0
|
|
| MD5 |
06fa96138f0d12abb9c3a549fe641bf5
|
|
| BLAKE2b-256 |
b0c17a69dd0879e639230d2e55d147e3af4c74eeed0f4cc1983721969d2cb0f5
|
File details
Details for the file storedoc-0.1.8-py3.7.egg.
File metadata
- Download URL: storedoc-0.1.8-py3.7.egg
- Upload date:
- Size: 12.5 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5115604e72e5e9d635bcf0e5c94e810c4cea9a15922a656bd54bc950852232ab
|
|
| MD5 |
5f90510c6b77bbd3535023d8ef0c3535
|
|
| BLAKE2b-256 |
6ce01903d5d9c744b56f49270755028cb1a04fe22b4c0f67bd637e7f8e508cbf
|