Skip to content

daemon_process.py bug 报告 #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
MingjunHu opened this issue Sep 18, 2024 · 0 comments
Open

daemon_process.py bug 报告 #26

MingjunHu opened this issue Sep 18, 2024 · 0 comments

Comments

@MingjunHu
Copy link

下面的方法 需要增加 路径是否存在的判断:
def hn_daily_job(hacker_news_client, report_generator, notifier):
LOG.info("[开始执行定时任务]Hacker News 今日前沿技术趋势")
# 获取当前日期,并格式化为 'YYYY-MM-DD' 格式
date = datetime.now().strftime('%Y-%m-%d')
# 生成每日汇总报告的目录路径
directory_path = os.path.join('hacker_news', date)
# 生成每日汇总报告并保存
report, _ = report_generator.generate_hn_daily_report(directory_path)
notifier.notify_hn_report(date, report)
LOG.info(f"[定时任务执行完毕]")

######修改为#########

def hn_daily_job(hacker_news_client, report_generator, notification_service):
LOG.info("[开始执行定时任务]Hacker News 今日前沿技术趋势")
# 获取当前日期,并格式化为 'YYYY-MM-DD' 格式
date = datetime.now().strftime('%Y-%m-%d')
# 生成每日汇总报告的目录路径
directory_path = os.path.join('hacker_news', date)
# 确保目录存在
os.makedirs(directory_path, exist_ok=True)
# 生成每日汇总报告并保存
report, _ = report_generator.generate_hn_daily_report(directory_path)
notification_service.send_email(f"[HackerNews] {date} 技术趋势", report)
LOG.info(f"[定时任务执行完毕]")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant