Skip to main content

A simple and easy to use async wrapper for Backblaze's B2 bucket API.

Project description

aiob2

Python version Build status PyPi License

aiob2 is an asynchronous API wrapper for the Backblaze B2 Bucket API.

It will allow you to interact with your B2 bucket and its files in a modern, object-oriented fashion.

NOTE: There are API endpoints left to implement, eventually they will be added. To speed up this process you can submit a pull request or suggest it.

Installation


aiob2 is compatible with Python 3.8+. To install aiob2, run the following command in your (virtual) environment.

pip install aiob2

Alternatively, for the latest though least stable version, you can download it from the GitHub repo:

pip install git+https://github.com/Void-ux/aiob2.git

Usage

Uploading

import aiohttp
import asyncio

from aiob2 import Client

# Our image to upload to our bucket
with open(r'C:\Users\MS1\Pictures\Camera Roll\IMG_5316.jpeg', 'rb') as file:
    data = file.read()

async def main():
    async with Client('key_id', 'key') as client:
        file = await client.upload_file(
            content_bytes=data,
            file_name='test.jpg',
            bucket_id='bucket_id',
        )


if __name__ == '__main__':
    asyncio.run(main())

And that's it! upload_file() returns a File object that neatly wraps everything Backblaze's API has provided us with. The File object's documentation can be found here

License

This project is released under the MIT License.

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

aiob2-0.8.4.tar.gz (19.3 kB view details)

Uploaded Source

Built Distribution

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

aiob2-0.8.4-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

Details for the file aiob2-0.8.4.tar.gz.

File metadata

  • Download URL: aiob2-0.8.4.tar.gz
  • Upload date:
  • Size: 19.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.10.2 Windows/10

File hashes

Hashes for aiob2-0.8.4.tar.gz
Algorithm Hash digest
SHA256 63ec20f1473c59bb7058160814be08fc18765ef3563cd49e01df557f258172f7
MD5 d3099c9f20f32ff90f13a3657f7d639b
BLAKE2b-256 bc4ca260927d294d513d733c8d95ea16fb93c5f9feea128639e2120518aa8f07

See more details on using hashes here.

File details

Details for the file aiob2-0.8.4-py3-none-any.whl.

File metadata

  • Download URL: aiob2-0.8.4-py3-none-any.whl
  • Upload date:
  • Size: 22.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.10.2 Windows/10

File hashes

Hashes for aiob2-0.8.4-py3-none-any.whl
Algorithm Hash digest
SHA256 4795da68fc6b3cb463c3b00d63a48bed2393242f7e6da49f8c02319bebc0bb7d
MD5 8ee75688ff6c4dbec213317633cb3739
BLAKE2b-256 fff89c009765577ccec36ca98b4697e2c0b40a00b915a049698fab8ee98cb8a3

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