fix: 增加重试机制
This commit is contained in:
parent
2d77f3ff51
commit
bd5580ee4b
11
main.py
11
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 第 {}期')
|
||||
|
|
|
|||
Loading…
Reference in New Issue