B2 Application key
- class b2sdk.v3.ApplicationKey(key_name, application_key_id, capabilities, account_id, expiration_timestamp_millis=None, bucket_ids=None, name_prefix=None, options=None)[source]
Dataclass for storing info about an application key returned by delete-key or list-keys.
- Parameters:
- classmethod from_api_response(response)[source]
Create an ApplicationKey object from a delete-key or list-key response (a parsed json object).
- Parameters:
response (
dict) –- Return type:
- __init__(key_name, application_key_id, capabilities, account_id, expiration_timestamp_millis=None, bucket_ids=None, name_prefix=None, options=None)
- Parameters:
key_name (
str) – name of the key, assigned by userapplication_key_id (
str) – key id, used to authenticatecapabilities (
list[str]) – list of capabilities assigned to this keyaccount_id (
str) – account’s idexpiration_timestamp_millis (
Optional[int]) – expiration time of the keybucket_id – if restricted to a bucket, this is the bucket’s id
name_prefix (
Optional[str]) – if restricted to some files, this is their prefix
- as_dict()
Represent the key as a dict, like the one returned by B2 cloud
- has_capabilities(capabilities)
checks whether the key has ALL of the given capabilities
- Return type:
- class b2sdk.v3.FullApplicationKey(key_name, application_key_id, application_key, capabilities, account_id, expiration_timestamp_millis=None, bucket_ids=None, name_prefix=None, options=None)[source]
Dataclass for storing info about an application key, including the actual key, as returned by create-key.
- Parameters:
- __init__(key_name, application_key_id, application_key, capabilities, account_id, expiration_timestamp_millis=None, bucket_ids=None, name_prefix=None, options=None)[source]
- Parameters:
key_name (
str) – name of the key, assigned by userapplication_key_id (
str) – key id, used to authenticateapplication_key (
str) – the actual secret keycapabilities (
list[str]) – list of capabilities assigned to this keyaccount_id (
str) – account’s idexpiration_timestamp_millis (
Optional[int]) – expiration time of the keybucket_id – if restricted to a bucket, this is the bucket’s id
name_prefix (
Optional[str]) – if restricted to some files, this is their prefix