Skip to main content

Upload and download files to common cloud providers like azure blob storage, s3 and more

Project description

FastCloud

Up & Download files to any cloud storage.

Simplistic unified interface for uploading and downloading files to the cloud.

Supports

  • Azure Blob Storage :white_check_mark:
  • S3 Storages (Amazon, ...) :question:

Installation

Install via pypi with:

# to support all cloud providers
pip install fastcloud[full]
# only support azure blob storage
pip install fastcloud[azure]
# only support s3
pip install fastcloud[s3]

Or check-out the repository and work from there.

Usage

Init storage (Azure blob, S3 ...)

To directly up and download files to the cloud storage provider, you can use the following code snippets.

from fastcloud import AzureBlobStorage, S3Storage, create_cloud_storage
# Create container of your choice
cloud_store = AzureBlobStorage(connection_string="DefaultEndpointsProtocol=https;AccountName=...;AccountKey=...;EndpointSuffix=...")
cloud_store = S3Storage(access_key_id, secret_access_key, region_name)
# Or use the factory to be more flexible
cloud_store = create_cloud_storage(... your credentials ...)

Recommendation: Use environment variables to store the cloud storage access tokens / credentials.

Upload and download files

Option 1: Just with plain bytes io

# upload. Will create a file in the cloud with the name my_file
file_url = cloud_store.upload(file="path/to/file", file_name="my_file", folder="my_upload_dir")
# download. Will download the file and save it to the save-path
cloud_store.download(file_id, save_path="path/to/save")

Option 2: with media-toolkit. Media-toolkit provides easy to use classes for images, videos, audio files.

from media_toolkit import ImageFile
# upload
my_img = ImageFile.from_np_array(my_cv2_img)
file_url = cloud_store.upload(file=my_img)
# download and parse as media_file
media_file = cloud_store.download(file_url)

Tutorials

How to setup Azure Blob Storage and get connection string?

  1. Go to portal.azure.com and login.
  2. Create a storage account of your choice (choose Blob Storage option)
  3. Navigate to storage account, click on containers and add container
  4. Go back to your storage account. Click on Access keys and copy the connection string.
  5. Add the connection string to your environment variables.

Contribute

Missing a cloud provider?

  • Just implement the missing class in core/providers with inheritance of the interface i_cloud_storage and make a pull request

Missing a feature?

  • Feel free to raise an issue. Better tough: just implement it and make a PR.

Also have a look at media-toolkit, FastTaskAPI for your personal cloud solution.

SUPPORT SOCAITY BY LEAVING A STAR

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastcloud-0.0.0.tar.gz (20.0 kB view details)

Uploaded Source

Built Distribution

fastcloud-0.0.0-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

Details for the file fastcloud-0.0.0.tar.gz.

File metadata

  • Download URL: fastcloud-0.0.0.tar.gz
  • Upload date:
  • Size: 20.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.11

File hashes

Hashes for fastcloud-0.0.0.tar.gz
Algorithm Hash digest
SHA256 7c8a54b5846e3f76db605495a760e0e76e8e332689dae1ab1fe7c482313ddf21
MD5 fe70be2df8e0ca9362d5feac04367d63
BLAKE2b-256 cdfe7871fd7f65551626033430b5fc6d1a7800692242e74e4fcf1b87388ea53b

See more details on using hashes here.

File details

Details for the file fastcloud-0.0.0-py3-none-any.whl.

File metadata

  • Download URL: fastcloud-0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 20.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.11

File hashes

Hashes for fastcloud-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1c032a347abe7e2cca57a530e2b326c506844ec95de3dd7c9f4be1f364268dcc
MD5 d8fc0cf198b6571fb46a8c729361cbd5
BLAKE2b-256 e9b20bac853b48c762e2622ff2ae5fae3c99e7af319c1fcaca2c7361317289b1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page