Skip to content
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

建议发送时间同时发送星期,节假日 #29

Open
L1Xu4n opened this issue Jun 6, 2023 · 0 comments
Open

建议发送时间同时发送星期,节假日 #29

L1Xu4n opened this issue Jun 6, 2023 · 0 comments

Comments

@L1Xu4n
Copy link

L1Xu4n commented Jun 6, 2023

希望改进发送time,同时发送时间,日期,星期,节假日
下面是我用gpt生成的可能的代码

import requests
from datetime import datetime

# 获取当前日期
current_date = datetime.now().strftime("%Y-%m-%d")

# 发送API请求
api_url = f"https://api.dategate.ai/holidays/{current_date}"
response = requests.get(api_url)
data = response.json()

# 打印当前日期
print("当前日期:", current_date)

# 打印当前星期
current_weekday = datetime.now().strftime("%A")
print("当前星期:", current_weekday)

# 检查是否有节日信息
if data:
    holiday_name = data[0]['name']
    print("节日:", holiday_name)
else:
    print("今天没有节日")
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