File: http_constants.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 (45 lines) | stat: -rw-r--r-- 1,555 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
######################################################################
#
# File: b2sdk/_internal/http_constants.py
#
# Copyright 2021 Backblaze Inc. All Rights Reserved.
#
# License https://www.backblaze.com/using_b2_code.html
#
######################################################################
from __future__ import annotations

import string

# These constants are needed in different modules, so they are stored in this module, that
# imports nothing, thus avoiding circular imports

# https://www.backblaze.com/docs/cloud-storage-buckets#bucket-names
BUCKET_NAME_CHARS = string.ascii_lowercase + string.digits + '-'
BUCKET_NAME_CHARS_UNIQ = string.ascii_lowercase + string.digits + '-'
BUCKET_NAME_LENGTH_RANGE = (6, 63)

LIST_FILE_NAMES_MAX_LIMIT = 10000  # https://www.backblaze.com/b2/docs/b2_list_file_names.html

FILE_INFO_HEADER_PREFIX = 'X-Bz-Info-'
FILE_INFO_HEADER_PREFIX_LOWER = FILE_INFO_HEADER_PREFIX.lower()

# Standard names for file info entries
SRC_LAST_MODIFIED_MILLIS = 'src_last_modified_millis'

# SHA-1 hash key for large files
LARGE_FILE_SHA1 = 'large_file_sha1'

# Special X-Bz-Content-Sha1 value to verify checksum at the end
HEX_DIGITS_AT_END = 'hex_digits_at_end'

# Identifying SSE_C keys
SSE_C_KEY_ID_FILE_INFO_KEY_NAME = 'sse_c_key_id'
SSE_C_KEY_ID_HEADER = FILE_INFO_HEADER_PREFIX + SSE_C_KEY_ID_FILE_INFO_KEY_NAME

# Default part sizes
MEGABYTE = 1000 * 1000
GIGABYTE = 1000 * MEGABYTE
DEFAULT_MIN_PART_SIZE = 5 * MEGABYTE
DEFAULT_RECOMMENDED_UPLOAD_PART_SIZE = 100 * MEGABYTE
DEFAULT_MAX_PART_SIZE = 5 * GIGABYTE