Remove ArchivingContext completely

Context for a specific url/item is now passed around via the metadata (metadata.set_context('key', 'val') and metadata.get_context('key', default='something')
The only other thing that was passed around in ArchivingContext was the storage info, which is already accessible now via self.config
This commit is contained in:
Patrick Robertson
2025-01-30 17:50:54 +01:00
parent d76063c3f3
commit c25d5cae84
19 changed files with 59 additions and 122 deletions

View File

@@ -56,6 +56,10 @@ class BaseModule(ABC):
# this is set by the orchestrator prior to archiving
tmp_dir: TemporaryDirectory = None
@property
def storages(self) -> list:
return self.config.get('storages', [])
def setup(self, config: dict):
authentication = config.get('authentication', {})
@@ -75,9 +79,6 @@ class BaseModule(ABC):
self.config = config
for key, val in config.get(self.name, {}).items():
setattr(self, key, val)
def repr(self):
return f"Module<'{self.display_name}' (config: {self.config[self.name]})>"
def auth_for_site(self, site: str) -> dict:
# TODO: think about if/how we can deal with sites that have multiple domains (main one is x.com/twitter.com)
@@ -97,4 +98,7 @@ class BaseModule(ABC):
did find information for '{key}' which is close, is this what you meant? \
If so, edit your authentication settings to make sure it exactly matches.")
return {}
return {}
def repr(self):
return f"Module<'{self.display_name}' (config: {self.config[self.name]})>"