Skip to content

Commit bca9916

Browse files
improve code
Signed-off-by: alokgoswami-ag <alok.goswami@ibm.com>
1 parent 35247d1 commit bca9916

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

monitor.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ def fetch_release_date(release):
2929
sys.exit(1)
3030
if response.status_code == 200:
3131
soup = BeautifulSoup(response.text, 'html.parser')
32+
forms = soup.find_all("form", {"method": "GET"})
3233
p_elements = soup.find_all("p")
3334
for p in p_elements:
3435
p_ele = p.string
3536
if p_ele:
3637
if "Created:" in p_ele:
3738
start_date = p_ele.split(" ")[1]+" "+p_ele.split(" ")[2]
3839
return start_date
39-
form = soup.find("form", {"method": "GET"})
40-
if form:
40+
for form in forms:
4141
a_tag = form.find("a", href=True)
4242
if a_tag and "changelog" in a_tag["href"]:
4343
changelog_url = constants.RELEASE_BASE_URL + a_tag["href"]
@@ -46,10 +46,8 @@ def fetch_release_date(release):
4646
lines = changelog_resp.text.splitlines()
4747
for line in lines:
4848
if "Created:" in line:
49-
parts = line.split()
50-
if len(parts) >= 3:
51-
start_date = parts[1] + " " + parts[2]
52-
return start_date
49+
start_date = line.split(" ")[1]+" "+line.split(" ")[2]
50+
return start_date
5351
else:
5452
print(f"Failed to get the changelog page.")
5553
sys.exit(1)

0 commit comments

Comments
 (0)