Newer
Older
#!/usr/bin/python
import os
import requests
url = 'https://validator.w3.org/feed/check.cgi'
with open(file,'r') as index_file:
index_lines = index_file.read().replace('\n','')
if "This is a valid Atom 1.0 feed" in r.content:
return "checkAtom: " + file + " is valid"
else:
return "checkAtom: " + file + " is NOT valid"
def checkHtml(file):
url = 'https://validator.w3.org/nu/'
files = {'file': open(file,'rb')}
r = requests.post(url, files=files)
if "The document validates" in r.content:
return "checkHtml: " + file + " is valid"
else:
return "checkHtml: " + file + " is NOT valid"
if __name__ == "__main__":
os.system('hugo --cleanDestinationDir')