kopia lustrzana https://github.com/bellingcat/auto-archiver
Add info on last check/last updated to the metadata
rodzic
394b8b2dd1
commit
1d664524eb
|
@ -1,6 +1,5 @@
|
|||
import os
|
||||
import hashlib
|
||||
from typing import TYPE_CHECKING
|
||||
import datetime
|
||||
|
||||
from loguru import logger
|
||||
import opentimestamps
|
||||
|
@ -108,7 +107,7 @@ class OpentimestampsEnricher(Enricher):
|
|||
# Create media for the timestamp file
|
||||
timestamp_media = Media(filename=timestamp_path)
|
||||
# explicitly set the mimetype, normally .ots files are 'application/vnd.oasis.opendocument.spreadsheet-template'
|
||||
media.mimetype = "application/vnd.opentimestamps"
|
||||
timestamp_media.mimetype = "application/vnd.opentimestamps"
|
||||
timestamp_media.set("opentimestamps_version", opentimestamps.__version__)
|
||||
|
||||
# Verify the timestamp if needed
|
||||
|
@ -158,13 +157,15 @@ class OpentimestampsEnricher(Enricher):
|
|||
|
||||
# Process different types of attestations
|
||||
if isinstance(attestation, PendingAttestation):
|
||||
info["type"] = f"pending (as of {attestation.date})"
|
||||
info["type"] = f"pending"
|
||||
info["uri"] = attestation.uri
|
||||
|
||||
elif isinstance(attestation, BitcoinBlockHeaderAttestation):
|
||||
info["type"] = "bitcoin"
|
||||
info["block_height"] = attestation.height
|
||||
|
||||
info["last_check"] = datetime.datetime.now().isoformat()[:-7]
|
||||
|
||||
attestation_info.append(info)
|
||||
|
||||
result["attestations"] = attestation_info
|
||||
|
@ -178,5 +179,6 @@ class OpentimestampsEnricher(Enricher):
|
|||
else:
|
||||
result["verified"] = False
|
||||
result["pending"] = False
|
||||
result["last_updated"] = datetime.datetime.now().isoformat()[:-7]
|
||||
|
||||
return result
|
Ładowanie…
Reference in New Issue