Skip to content

Commit

Permalink
Add #.retry method to CrawlJob
Browse files Browse the repository at this point in the history
Fix #955
  • Loading branch information
Yomguithereal committed Apr 15, 2024
1 parent e6db6ae commit b7319fc
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions minet/crawl/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit b7319fc

Please sign in to comment.