File: b2http.py

package info (click to toggle)
python-b2sdk 2.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,020 kB
  • sloc: python: 30,902; sh: 13; makefile: 8
file content (24 lines) | stat: -rw-r--r-- 804 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
######################################################################
#
# File: b2sdk/v2/b2http.py
#
# Copyright 2021 Backblaze Inc. All Rights Reserved.
#
# License https://www.backblaze.com/using_b2_code.html
#
######################################################################
from __future__ import annotations

from b2sdk import _v3 as v3
from b2sdk._v3.exception import BucketIdNotFound as v3BucketIdNotFound
from .exception import BucketIdNotFound


# Overridden to retain old-style BadRequest exception in case of a bad bucket id
class B2Http(v3.B2Http):
    @classmethod
    def _translate_errors(cls, fcn, post_params=None):
        try:
            return super()._translate_errors(fcn, post_params)
        except v3BucketIdNotFound as e:
            raise BucketIdNotFound(e.bucket_id)