当前位置: 首页 > 工具软件 > PyWapFetion > 使用案例 >

利用PyWapFetion发免费天气短信

濮阳弘扬
2023-12-01

用到的第三方资源:

我的代码forecast.py只有几行:

1 #!/usr/bin/python
2 #-*-coding:utf-8 -*-
3 import PyWapFetion
4 import feedparser
5 weather_source = "http://weather.raychou.com/?/detail/57494/rss"
6 d=feedparser.parse(weather_source)
7 send_content = d.feed.title + "\n明天:" + d.entries[1].description + "\n后天:" +  d.entries[2].description
8 print send_content
9 PyWapFetion.send("15171456221","mypasswd","15171456221",send_content)

如果要每天定时发送,那么就将这个脚本使用Linux的计划任务Crontab定时执行。 

转载于:https://www.cnblogs.com/whatcanyou/p/3397733.html

 类似资料: