🛜修复字典获取没有使用索引的问题
This commit is contained in:
parent
38895a9d66
commit
cc876f3dbe
@ -61,6 +61,8 @@ def send_emails(emails, sender_email, smtp_server, port, password, subject, body
|
|||||||
use_tls (bool): 是否使用 TLS 加密,默认为 True。
|
use_tls (bool): 是否使用 TLS 加密,默认为 True。
|
||||||
"""
|
"""
|
||||||
for email in emails:
|
for email in emails:
|
||||||
|
print(f'正在发送邮件到 {email}')
|
||||||
|
print(f'---------------------------\n邮件主题: {subject}\n邮件内容: {body}\n发件人: {sender_email}\n---------------------------')
|
||||||
email_sender(email, sender_email, smtp_server, port, password, subject, body, use_tls)
|
email_sender(email, sender_email, smtp_server, port, password, subject, body, use_tls)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,13 +1,5 @@
|
|||||||
{
|
{
|
||||||
"articles": [
|
"articles": [
|
||||||
{
|
|
||||||
"title": "东软软件园实习日记",
|
|
||||||
"author": "",
|
|
||||||
"link": "https://blog.qyliu.top/posts/13e6e155/",
|
|
||||||
"published": "2024-07-01 08:39",
|
|
||||||
"summary": "大学生累成狗,今天我终于理解了为什么这么说,好不容易结束了为期七天的实训课程,又要写实验报告加小组作业,好不容易完成了小组作业,这不,十五天实习又来了!烦!并且还要天天写学习日志?我直接当作日记写好不好!",
|
|
||||||
"content": "大学生累成狗,今天我终于理解了为什么这么说,好不容易结束了为期七天的实训课程,又要写实验报告加小组作业,好不容易完成了小组作业,这不,十五天实习又来了!烦!并且还要天天写学习日志?我直接当作日记写好不好!"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"title": "Github Action实现友链状态检测",
|
"title": "Github Action实现友链状态检测",
|
||||||
"author": "",
|
"author": "",
|
||||||
|
17
run.py
17
run.py
@ -37,13 +37,6 @@ if config["rss_subscribe"]["enable"]:
|
|||||||
github_username = config["rss_subscribe"]["github_username"]
|
github_username = config["rss_subscribe"]["github_username"]
|
||||||
github_repo = config["rss_subscribe"]["github_repo"]
|
github_repo = config["rss_subscribe"]["github_repo"]
|
||||||
your_blog_url = config["rss_subscribe"]["your_blog_url"]
|
your_blog_url = config["rss_subscribe"]["your_blog_url"]
|
||||||
github_api_url = "https://api.github.com/repos/" + github_username + "/" + github_repo + "/issues" + "?state=closed"
|
|
||||||
print("正在从 {github_api_url} 中获取订阅信息".format(github_api_url=github_api_url))
|
|
||||||
email_list = extract_emails_from_issues(github_api_url)
|
|
||||||
if email_list == None:
|
|
||||||
print("无邮箱列表")
|
|
||||||
sys.exit()
|
|
||||||
print("获取到的邮箱列表为:", email_list)
|
|
||||||
# 获取最近更新的文章
|
# 获取最近更新的文章
|
||||||
latest_articles = get_latest_articles_from_link(
|
latest_articles = get_latest_articles_from_link(
|
||||||
url=your_blog_url,
|
url=your_blog_url,
|
||||||
@ -54,10 +47,18 @@ if config["rss_subscribe"]["enable"]:
|
|||||||
if latest_articles == None:
|
if latest_articles == None:
|
||||||
print("没有新文章")
|
print("没有新文章")
|
||||||
else:
|
else:
|
||||||
|
github_api_url = "https://api.github.com/repos/" + github_username + "/" + github_repo + "/issues" + "?state=closed"
|
||||||
|
print("正在从 {github_api_url} 中获取订阅信息".format(github_api_url=github_api_url))
|
||||||
|
email_list = extract_emails_from_issues(github_api_url)
|
||||||
|
if email_list == None:
|
||||||
|
print("无邮箱列表")
|
||||||
|
sys.exit(0)
|
||||||
|
else:
|
||||||
|
print("获取到的邮箱列表为:", email_list)
|
||||||
# 循环latest_articles,发送邮件
|
# 循环latest_articles,发送邮件
|
||||||
for article in latest_articles:
|
for article in latest_articles:
|
||||||
send_emails(
|
send_emails(
|
||||||
emails=email_list,
|
emails=email_list["emails"],
|
||||||
sender_email=email,
|
sender_email=email,
|
||||||
smtp_server=server,
|
smtp_server=server,
|
||||||
port=port,
|
port=port,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user