diff --git a/clients/windows.py b/clients/windows.py index 1a4ee75..256c82b 100644 --- a/clients/windows.py +++ b/clients/windows.py @@ -18,7 +18,7 @@ def getEditions(template): template.ends = date.max template.stable = True template.latest = False - maxver = 1507 + maxver = date(2015, 7, 29) # Looking for releases, source at https://docs.microsoft.com/en-us/windows/windows-10/release-information body = urllib.request.urlopen("https://winreleaseinfoprod.blob.core.windows.net/winreleaseinfoprod/en-US.html").read() @@ -33,45 +33,33 @@ def getEditions(template): item = copy.copy(template) # copy of Softver object # find release date - value = cols[4].get_text().strip().split('.')[0] + value = cols[4].get_text().strip() item.released = datetime.strptime(value, '%Y-%m-%d').date() + # find end of service date + value = cols[5].get_text().strip() + try: + item.ends = datetime.strptime(value, '%Y-%m-%d').date() + except ValueError: + item.ends = date.min + # find version item.version = cols[3].get_text().strip() - item.edition = cols[0].get_text().strip().split(' ')[0] #strip after first 4 chars, as MS adds unusual things there - item.edition = item.edition[:4] + item.edition = cols[0].get_text().strip()[:4] # find the latest version (to be set later) - if int(item.edition) > maxver: - maxver = int(item.edition) + item.avail = datetime.strptime(cols[2].get_text().strip(), '%Y-%m-%d').date() + if item.avail > maxver: + maxver = item.avail result.append(item) # mark the latest version for item in result: - if item.edition == str(maxver): + if item.avail == maxver: item.latest = True - - # Looking for end support date, source at https://support.microsoft.com/en-ca/help/13853/windows-lifecycle-fact-sheet - body = urllib.request.urlopen("https://support.microsoft.com/en-ca/help/13853/windows-lifecycle-fact-sheet").read() - soup = BeautifulSoup(body, "html5lib") - - # Data to be found in a script tag used by their angular function, not pure html; we get them all - script = str(soup.find_all("script")) - - for item in result: - ver = item.edition #ex. 1809 - - # find the beginning and end of the html'like table contents with version related dates - start = str(script).find("