def __init__(self): self.logger = llogger('log/jsl_monitor') self.session = requests.Session() self.cookies = config.jsl_cookies self.headers = { 'Sec-Fetch-Mode': 'cors', 'Origin': 'https://www.jisilu.cn', 'Accept-Encoding': 'gzip, deflate, br', 'Accept-Language': 'zh,en;q=0.9,en-US;q=0.8', 'X-Requested-With': 'XMLHttpRequest', 'Connection': 'keep-alive', 'Pragma': 'no-cache', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'Accept': 'application/json, text/javascript, */*; q=0.01', 'Cache-Control': 'no-cache', 'Referer': 'https://www.jisilu.cn/data/cbnew/', 'Sec-Fetch-Site': 'same-origin', } self.params = ( ('___jsl', 'LST___t=1579488785838'), ) self.data = { 'fprice': '', 'tprice': '', 'volume': '', 'svolume': '', 'premium_rt': '', 'ytm_rt': '', 'rating_cd': '', 'is_search': 'Y', 'btype': 'C', 'listed': 'Y', 'sw_cd': '', 'bond_ids': '', 'rp': '50' } self.history = HistorySet(expire=config.EXPIRE_TIME)
def test_non_eidetic(): history_set = HistorySet([1, 2, 3], eidetic=True) history_set.add(4) history_set.remove(4) assert (history_set.added() == {4}) assert (history_set.removed() == {4})
def history_set(): yield HistorySet([1, 2, 3])