Add haproxy as custom

This commit is contained in:
Nemo
2022-05-24 14:55:54 +05:30
parent 87d4f29eba
commit 624c6a4d14
3 changed files with 96 additions and 0 deletions

18
src/haproxy.py Normal file
View File

@@ -0,0 +1,18 @@
import json
import re
import urllib.request
URL = "https://www.haproxy.org/download/2.6/src/CHANGELOG"
REGEX = r'^(\d{4})\/(\d{2})\/(\d{2})\s+:\s+(\d+\.\d+\.\d.?)$'
list = {}
with urllib.request.urlopen(URL) as response:
for line in response:
m = re.match(REGEX, line.decode('utf-8'))
if m:
year,month,date,version = m.groups()
abs_date = "%s-%s-%s" % (year, month, date)
list[abs_date] = version
with open('releases/custom/haproxy.json', 'w') as f:
f.write(json.dumps(list, indent=2))