Add comments

pull/31/head
Stijn De Clercq 2021-01-26 22:00:20 +01:00
parent 7fe2689db1
commit 342db2df38
2 changed files with 4 additions and 0 deletions

View File

@ -143,6 +143,7 @@ def getTable():
if rows is None: if rows is None:
return "Er ging iets fout. Probeer het later opnieuw." return "Er ging iets fout. Probeer het later opnieuw."
# Format every row to work for Tabulate
formatted = [_formatRow(row) for row in rows] formatted = [_formatRow(row) for row in rows]
header = "Jupiler Pro League Klassement" header = "Jupiler Pro League Klassement"
@ -156,6 +157,8 @@ def _formatRow(row):
Function that formats a row into a list for Tabulate to use Function that formats a row into a list for Tabulate to use
""" """
scoresArray = list([td.renderContents().decode("utf-8") for td in row.find_all("td")])[:6] scoresArray = list([td.renderContents().decode("utf-8") for td in row.find_all("td")])[:6]
# Insert the team name into the list # Insert the team name into the list
scoresArray.insert(1, row.find_all("a")[0].renderContents().decode("utf-8").split("<!--")[0]) scoresArray.insert(1, row.find_all("a")[0].renderContents().decode("utf-8").split("<!--")[0])
return scoresArray return scoresArray

View File

@ -97,6 +97,7 @@ def getJPLTable():
""" """
page_html = get("https://sporza.be/nl/categorie/voetbal/jupiler-pro-league/") page_html = get("https://sporza.be/nl/categorie/voetbal/jupiler-pro-league/")
# Something went wrong
if page_html.status_code != 200: if page_html.status_code != 200:
return None return None