Openresty Python LUA

Openresty Python LUA 学习资料 QQ群:397745473

0%

python 文件更新检测

python 文件更新检测

测试在线网站的 last-modified ….

QQ群:397745473

1
2
3
4
5
6
7
8
9
import requests
import datetime
from dateutil.parser import parse as parsedate
r = requests.head(url)
url_time = r.headers['last-modified']
url_date = parsedate(url_time)
file_time = datetime.datetime.fromtimestamp(os.path.getmtime(dstFile))
if url_date > file_time :
print(donwload it !)

更多参考:https://stackoverflow.com/questions/29314287/python-requests-download-only-if-newer

QQ群:397745473

欢迎关注我的其它发布渠道