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:
  • Socaity Upload API
  • Replicate Upload API

Installation

Install via pypi with:

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

Or check-out the repository and work from there.

Usage

Init storage (Azure Blob)

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

from fastcloud import AzureBlobStorage
# Create storage client
cloud_store = AzureBlobStorage(connection_string="DefaultEndpointsProtocol=https;AccountName=...;AccountKey=...;EndpointSuffix=...")

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.13.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastcloud-0.0.13-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for fastcloud-0.0.13.tar.gz
Algorithm Hash digest
SHA256 005afd26c80a4cabc8c63e115fd2c19346c8d59c1f8ff8547c9253bbb42231ea
MD5 f31072dbb12bdcbf9f6b26fc113b43ff
BLAKE2b-256 d528df5661ed07959a1a886f6ef263a4dde2b94c236f30a249a121b8ac90f32b

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for fastcloud-0.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 e1ddce6af8497c217fe26318a58fa37b7e80dc0b19ac444ed34234f8a6c8da4d
MD5 efca2051f87176d22d0665382bc49a19
BLAKE2b-256 d752dd88cb299c55cfde4199d676a2c4d88f19179765c65a0c016a2ef52f878c

See more details on using hashes here.

Supported by

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