archivebox.base_models.abid

Module Contents

Classes

ABID

e.g. ABID(‘obj_01HX9FPYTRE4A5CCD901ZYEBQE’)

Functions

uri_hash

https://example.com -> ‘E4A5CCD9AF4ED2A6E0954DF19FD274E9CDDB4853051F033FD518BFC90AA1AC25’ (example.com)

abid_part_from_prefix

‘snp_’

abid_part_from_uri

‘E4A5CCD9’ # takes first 8 characters of sha256(url)

abid_part_from_ts

‘01HX9FPYTR’ # produces 10 character Timestamp section of ulid based on added date

ts_from_abid

abid_part_from_subtype

Snapshots have 01 type, other objects have other subtypes like wget/media/etc. Also allows us to change the ulid spec later by putting special sigil values here.

abid_part_from_rand

‘ZYEBQE’ # takes last 6 characters of randomness from existing legacy uuid db field

abid_hashes_from_values

abid_from_values

Return a freshly derived ABID (assembled from attrs defined in ABIDModel.abid_*_src).

Data

ABID_PREFIX_LEN

ABID_SUFFIX_LEN

ABID_LEN

ABID_TS_LEN

ABID_URI_LEN

ABID_SUBTYPE_LEN

ABID_RAND_LEN

DEFAULT_ABID_PREFIX

DEFAULT_ABID_URI_SALT

API

archivebox.base_models.abid.ABID_PREFIX_LEN[source]

4

archivebox.base_models.abid.ABID_SUFFIX_LEN[source]

26

archivebox.base_models.abid.ABID_LEN[source]

30

archivebox.base_models.abid.ABID_TS_LEN[source]

10

archivebox.base_models.abid.ABID_URI_LEN[source]

8

archivebox.base_models.abid.ABID_SUBTYPE_LEN[source]

2

archivebox.base_models.abid.ABID_RAND_LEN[source]

6

archivebox.base_models.abid.DEFAULT_ABID_PREFIX[source]

‘obj_’

archivebox.base_models.abid.DEFAULT_ABID_URI_SALT[source]

‘687c2fff14e3a7780faa5a40c237b19b5b51b089’

class archivebox.base_models.abid.ABID[source]

Bases: typing.NamedTuple

e.g. ABID(‘obj_01HX9FPYTRE4A5CCD901ZYEBQE’)

prefix: str[source]

None

ts: str[source]

None

uri: str[source]

None

subtype: str[source]

None

rand: str[source]

None

__getattr__(attr: str) Any[source]
__eq__(other: Any) bool[source]
__str__() str[source]
__len__() int[source]
classmethod parse(buffer: Union[str, uuid.UUID, ulid.ULID, typeid.TypeID, archivebox.base_models.abid.ABID], prefix=DEFAULT_ABID_PREFIX) archivebox.base_models.abid.ABID[source]
property uri_salt: str[source]
property suffix[source]
property ulid: ulid.ULID[source]
property uuid: uuid.UUID[source]
property uuid6: uuid6.UUID[source]
property typeid: typeid.TypeID[source]
property datetime: datetime.datetime[source]
archivebox.base_models.abid.uri_hash(uri: Union[str, bytes], salt: str = DEFAULT_ABID_URI_SALT) str[source]

https://example.com -> ‘E4A5CCD9AF4ED2A6E0954DF19FD274E9CDDB4853051F033FD518BFC90AA1AC25’ (example.com)

archivebox.base_models.abid.abid_part_from_prefix(prefix: str) str[source]

‘snp_’

archivebox.base_models.abid.abid_part_from_uri(uri: Any, salt: str = DEFAULT_ABID_URI_SALT) str[source]

‘E4A5CCD9’ # takes first 8 characters of sha256(url)

archivebox.base_models.abid.abid_part_from_ts(ts: datetime.datetime) str[source]

‘01HX9FPYTR’ # produces 10 character Timestamp section of ulid based on added date

archivebox.base_models.abid.ts_from_abid(abid: str) datetime.datetime[source]
archivebox.base_models.abid.abid_part_from_subtype(subtype: str | int) str[source]

Snapshots have 01 type, other objects have other subtypes like wget/media/etc. Also allows us to change the ulid spec later by putting special sigil values here.

archivebox.base_models.abid.abid_part_from_rand(rand: Union[str, uuid.UUID, None, int]) str[source]

‘ZYEBQE’ # takes last 6 characters of randomness from existing legacy uuid db field

archivebox.base_models.abid.abid_hashes_from_values(prefix: str, ts: datetime.datetime, uri: Any, subtype: str | int, rand: Union[str, uuid.UUID, None, int], salt: str = DEFAULT_ABID_URI_SALT) Dict[str, str][source]
archivebox.base_models.abid.abid_from_values(prefix: str, ts: datetime.datetime, uri: str, subtype: str, rand: Union[str, uuid.UUID, None, int], salt: str = DEFAULT_ABID_URI_SALT) archivebox.base_models.abid.ABID[source]

Return a freshly derived ABID (assembled from attrs defined in ABIDModel.abid_*_src).