[英]Python script that notifies me when a update is made to a website.
I need to make a script that will notify me when a change is made to a website. 我需要制作一个脚本,以便在对网站进行更改时通知我。 I am not sure about the best way to go about this and I don't know what python has that will be useful.
我不确定最好的方法,我不知道python有什么用处。 Any push in the right direction would be helpful.
任何正确方向的推动都会有所帮助。
You may use the last-modified date of the remote page : 您可以使用远程页面的上次修改日期:
import urllib
u = urllib.urlopen("http://www.google.com")
u.info().get("last-modified")
It all depends on what you define as an update to a website. 这完全取决于您定义的网站更新。
The simplest solution would be to use urllib2 to get the contents of the given website, storing it in a variable then quering the website again for contents and comparing them. 最简单的解决方案是使用urllib2获取给定网站的内容,将其存储在变量中,然后再次查询网站内容并进行比较。
Have that running in an infinite loop and you are set. 让它在无限循环中运行并且你已经设置好了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.