A simple and easy to use async wrapper for Backblaze's B2 bucket API.
Project description
aiob2
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
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
File details
Details for the file aiob2-0.8.5.tar.gz
.
File metadata
- Download URL: aiob2-0.8.5.tar.gz
- Upload date:
- Size: 19.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.2 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5b70f21356b76a7cb421e437518bfbdc26eb2580a07277e2cca257d806a5f3a |
|
MD5 | 040315518c558904cf4086ee118bfc87 |
|
BLAKE2b-256 | 2069dff2b17b0ddce6e42b80888bdc1190896b72b3058b69dc0985623ffacd88 |
File details
Details for the file aiob2-0.8.5-py3-none-any.whl
.
File metadata
- Download URL: aiob2-0.8.5-py3-none-any.whl
- Upload date:
- Size: 23.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.2 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5661c2db7ec1cb19e3a55d6c7306a27e4876042316915cbd1ff22756f5a0dee |
|
MD5 | c98e2351375fa465c79b05ad0d670d3b |
|
BLAKE2b-256 | 937710d6b384048cc41062028de99c03cc7d61fe87e48ed7b4a9dd8eb9ea001b |