Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/void-ux/aiob2
A modern and Pythonic Backblaze B2 API wrapper
https://github.com/void-ux/aiob2
b2 backblaze cloud storage
Last synced: 6 days ago
JSON representation
A modern and Pythonic Backblaze B2 API wrapper
- Host: GitHub
- URL: https://github.com/void-ux/aiob2
- Owner: Void-ux
- License: mit
- Created: 2022-05-14T21:50:23.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-07-07T12:05:06.000Z (6 months ago)
- Last Synced: 2024-07-08T12:28:22.343Z (6 months ago)
- Topics: b2, backblaze, cloud, storage
- Language: Python
- Homepage: https://aiob2.readthedocs.io/en/latest/
- Size: 20.8 MB
- Stars: 11
- Watchers: 1
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# aiob2
aiob2 is an asynchronous API wrapper for the [Backblaze B2 Bucket API](https://www.backblaze.com/b2/docs/calling.html).
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](https://github.com/Void-ux/aiob2/pulls) or [suggest it](https://github.com/Void-ux/aiob2/discussions/categories/ideas).
## Installation
---
aiob2 is compatible with Python 3.8+. To install aiob2, run the following command in your (virtual) environment.
```shell
pip install aiob2
```Alternatively, for the latest though least stable version, you can download it from the GitHub repo:
```shell
pip install git+https://github.com/Void-ux/aiob2.git
```## Usage
### Uploading
```python
import aiohttp
import asynciofrom 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](https://aiob2.readthedocs.io/en/latest/pages/api.html#aiob2.File)## License
This project is released under the [MIT License](https://opensource.org/licenses/MIT).