B2 Api client¶
-
class
b2sdk.v1.
B2Api
[source]¶ -
SESSION_CLASS
¶ alias of
b2sdk.v1.session.B2Session
-
BUCKET_FACTORY_CLASS
¶ alias of
b2sdk.v1.bucket.BucketFactory
-
BUCKET_CLASS
¶ alias of
b2sdk.v1.bucket.Bucket
-
get_bucket_by_id
(bucket_id)[source]¶ Return a bucket object with a given ID. Unlike
get_bucket_by_name
, this method does not need to make any API calls.- Parameters
bucket_id (str) – a bucket ID
- Returns
a Bucket object
- Return type
-
check_bucket_restrictions
(bucket_name)[source]¶ Check to see if the allowed field from authorize-account has a bucket restriction.
If it does, checks if the bucket_name for a given api call matches that. If not, it raises a
b2sdk.v1.exception.RestrictedBucket
error.- Parameters
bucket_name (str) – a bucket name
- Raises
b2sdk.v1.exception.RestrictedBucket – if the account is not allowed to use this bucket
-