From b7319fc0e684b196670ea735afbd6c642e077462 Mon Sep 17 00:00:00 2001 From: Yomguithereal Date: Mon, 15 Apr 2024 14:56:21 +0200 Subject: [PATCH] Add #.retry method to CrawlJob Fix #955 --- minet/crawl/types.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/minet/crawl/types.py b/minet/crawl/types.py index 1f4a098bbe..1144118056 100644 --- a/minet/crawl/types.py +++ b/minet/crawl/types.py @@ -197,6 +197,15 @@ def __repr__(self): conditionals=("data", "spider", "parent", "group", "priority"), ) + def retry(self, priority: Optional[int] = 0) -> CrawlTarget[CrawlJobDataType]: + return CrawlTarget( + url=self.url, + depth=self.depth, + spider=self.spider, + priority=priority if priority is not None else self.priority, + data=self.data, + ) + class CrawlResult(Generic[CrawlJobDataType, CrawlResultDataType]): __slots__ = ("job", "data", "error", "response", "degree")