https://github.com/phistrom/b2sdk-redis-accountinfo
b2sdk AccountInfo implementation that uses Redis
https://github.com/phistrom/b2sdk-redis-accountinfo
Last synced: 4 months ago
JSON representation
b2sdk AccountInfo implementation that uses Redis
- Host: GitHub
- URL: https://github.com/phistrom/b2sdk-redis-accountinfo
- Owner: phistrom
- License: mit
- Created: 2020-07-06T21:54:19.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T11:05:09.000Z (over 2 years ago)
- Last Synced: 2024-12-27T00:11:58.929Z (6 months ago)
- Language: Python
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RedisAccountInfo for b2sdk
Use Redis to cache your b2-sdk-python account info!## What It Is
The official B2 Python SDK (b2sdk) uses AccountInfo objects to store your credentials, authorization tokens, and bucket name to ID mappings. Only SqliteAccountInfo and InMemoryAccountInfo are provided by default.**RedisAccountInfo:**
- Implements `b2sdk.account_info.abstract.AbstractAccountInfo`
- Implements `b2sdk.cache.AbstractCache`
- Operations are atomic and transactional. Safe for multithreaded and multiprocess applications!## Example
```py
import b2sdk.v1 as b2
from b2sdk_redis import RedisAccountInfoinfo = RedisAccountInfo(host="localhost")
b2api = b2.B2Api(info, cache=info) # use cache=info to cache bucket name to ID mappings
b2api.authorize_account(
realm="production",
application_key_id=app_key_id,
application_key=secret_key
)
for b in b2api.list_buckets():
print(b)
```## Alpha!
- Hasn't been rigorously tested
- Safety not guaranteed## License
MIT