Skip to main content

Add your description here

Project description

Blackhole

ActiveStorage, but for Python

The universal file storage adapter for the major Cloud storage services like AWS S3, Google Cloud, Azure but also can be used for the local storage.

TODOs

[ ] aws, gcp and azure providers [ ] aiofiles for local adapter [ ] tests [ ] get settings from yaml file (pydantic-settings) [ ] middlewares (pre/post) [ ] put_later - background job uploading/downloading [ ] ...

Init

config = S3Config(
    access_key="...",
    secret_key="...",
    region="us-east-1",
    bucket="...",
)
bh = Blackhole(config=config)

Save

file = ... # some BinaryIO / bytes / file path string

storage_file = storage.put(file)

if storage.exists(file):
    storage.delete(file)

bh_file = storage.get(file)

print(bh_file.filename)

return bh_file.blob #  returns bytes

FastApi

config = ...
bh = Blackhole(config)

@app.post("/uploadfiles/")
async def create_upload_file(files: list[UploadFile]):
    filenames = await bh.put(files)
    return {"filename": filenames}

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

blackhole_io-0.1.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

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

blackhole_io-0.1.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file blackhole_io-0.1.0.tar.gz.

File metadata

  • Download URL: blackhole_io-0.1.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.5

File hashes

Hashes for blackhole_io-0.1.0.tar.gz
Algorithm Hash digest
SHA256 14000238a7d252485e3e1423807bb3384c13031c2d8241694562b8bf40dfdd21
MD5 9b1efc5532d46f4aae128f8ff603f073
BLAKE2b-256 eb1868e7aec316e2dfd934127c2318caaf02be48fc261a2ed8c0942dc66b451e

See more details on using hashes here.

File details

Details for the file blackhole_io-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for blackhole_io-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4a163f83b501f5fb78fa74183c5b5d2bd555216ec01a476205d57629fe0965e1
MD5 36502dc8198f18d1859fc9536c713bd9
BLAKE2b-256 fa51f31680a4ac9fe68428e42bd4e3bfa673ab0b842b10d8a9b1d4edac9388d6

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