Store
Memory runs through the entire process of script execution, helping you collect and store information during the script execution process
Implement Store
import crawlipt as cpt
class Store(cpt.StoreBase):
@check
def __init__(self, is_replace: bool = False):
"""
:param is_replace: need replace the value of method or not
"""
self.is_replace = is_replace
self.data = {}
@check
def set(self, method: str, value: Any) -> None:
if method in self.data.keys():
if self.is_replace:
self.data[method] = value
else:
self.data[method].append(value)
return
if self.is_replace:
self.data[method] = value
else:
self.data[method] = [value]Built-in Store object
Using Store
Last updated