From bd5580ee4b7fdbb601efffd23827d6dde36633f5 Mon Sep 17 00:00:00 2001 From: chenwj113 Date: Sun, 9 Jul 2023 22:19:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A2=9E=E5=8A=A0=E9=87=8D=E8=AF=95?= =?UTF-8?q?=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 20ce441..d33e520 100644 --- a/main.py +++ b/main.py @@ -1,5 +1,5 @@ import time - +from retrying import retry from schedule import every, repeat, run_pending from requests_html import HTML, HTMLSession @@ -8,11 +8,16 @@ from lottery import Lottery session = HTMLSession() -def get_data_job(lottery_type='pls'): + +@retry(stop_max_attempt_number=5) +def get_data_job(lottery_type='pls', issue=None): """ :param lottery_type """ - url = f"https://kaijiang.500.com/{lottery_type}.shtml" + if issue is None: + url = f"https://kaijiang.500.com/{lottery_type}.shtml" + else: + url = f"http://kaijiang.500.com/shtml/{lottery_type}/{issue}.shtml" r = session.get(url) if lottery_type == 'pls': issue_elem = r.html.search('排列3 第 {}期')