Skip to content

Commit

Permalink
Prevent errors when the spider instance is not yet assigned to the cr…
Browse files Browse the repository at this point in the history
…awler instance by using the spidercls attribute instead
  • Loading branch information
Wesley van Lee committed Nov 1, 2024
1 parent a570295 commit cd606b8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scrapy_webarchive/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def __init__(self, settings: Settings, crawler: Crawler) -> None:

# Initialize store and writer
self.store: FilesStoreProtocol = self._get_store(store_uri)
self.writer = WarcFileWriter(collection_name=crawler.spider.name)
self.writer = WarcFileWriter(collection_name=crawler.spidercls.name)

def _check_configuration_prerequisites(self) -> None:
"""raises NotConfigured if essential settings or middleware configurations are incorrect."""
Expand All @@ -82,7 +82,7 @@ def _retrieve_store_uri_and_wacz_fname(self) -> Tuple[str, Union[str, None]]:
"""Sets up the export URI based on configuration and spider context."""

export_uri = self.settings["SW_EXPORT_URI"].format(
spider=self.crawler.spider.name,
spider=self.crawler.spidercls.name,
**get_archive_uri_template_dt_variables(),
)

Expand Down

0 comments on commit cd606b8

Please sign in to comment.