1234567891011121314151617181920212223242526272829303132 |
- # -*- coding: utf-8 -*-
- # @Author: wangkun
- # @Time: 2022/8/3
- import datetime
- import os
- import random
- import sys
- import time
- sys.path.append(os.getcwd())
- from main.gzh_recommend import Recommend
- from main.common import Common
- class Main:
- @classmethod
- def main(cls):
- while True:
- if 21 >= datetime.datetime.now().hour >= 8:
- # 获取列表
- Recommend.get_recommend_by_token("recommend")
- # 下载/上传
- Recommend.run_download_publish("recommend", "prod")
- # 清除日志
- Common.del_logs("recommend")
- # 随机休眠 10 - 20s
- Common.logger("recommend").info("随机休眠 10 - 20s")
- time.sleep(random.randint(10, 20))
- if __name__ == "__main__":
- Main.main()
|