AccountInfo stores basic information about the account, such as Application Key ID and Application Key,
in order to let
b2sdk.v2.B2Api perform authenticated requests.
There are two usable implementations provided by b2sdk:
b2sdk.v2.InMemoryAccountInfo- a basic implementation with no persistence
b2sdk.v2.SqliteAccountInfo- for console and GUI applications
They both provide the full AccountInfo interface.
Backup applications and many server-side applications should implement their own AccountInfo, backed by the metadata/configuration database of the application.
AccountInfo with no persistence.
Implementing your own
When building a server-side application or a web service, you might want to implement your own AccountInfo class backed by a database. In such case, you should inherit from
b2sdk.v2.UrlPoolAccountInfo, which has groundwork for url pool functionality). If you cannot use it, inherit directly from
>>> from b2sdk.v2 import UrlPoolAccountInfo >>> class MyAccountInfo(UrlPoolAccountInfo): ...
b2sdk.v2.AbstractAccountInfo describes the interface, while
b2sdk.v2.UploadUrlPool implement a part of the interface for in-memory upload token management.
AccountInfo helper classes
- class b2sdk.account_info.upload_url_pool.UploadUrlPool
For each key (either a bucket id or large file id), hold a pool of (url, auth_token) pairs.
This class is not part of the public interface. To find out how to safely use it, read this.
- put(key, url, auth_token)
Add the url and auth token to the pool for the given key.
Return a (url, auth_token) if one is available, or (None, None) if not.