@@ -21,7 +21,7 @@ def parse_html(self, soup: ResultSet) -> List[Dict]:
2121 Returns:
2222 Dict: The data dict containing circuit maintenance data.
2323 """
24- data : Dict [str , Any ] = {"circuits" : list () }
24+ data : Dict [str , Any ] = {"circuits" : [] }
2525
2626 impact = self ._parse_b (soup .find_all ("b" ), data )
2727 self ._parse_table (soup .find_all ("th" ), data , impact )
@@ -54,18 +54,29 @@ def _parse_b(self, b_elements, data):
5454 impact (Status object): impact of the maintenance notification (used in the parse table function to assign an impact for each circuit).
5555 """
5656 impact = None
57+ start_year = 0
58+ end_year = 0
5759 for b_elem in b_elements :
60+ if "SPAN:" in b_elem .text :
61+ # Formated in DAY MONTH YEAR
62+ # *SPAN: 02-JUL-2021 - 03-JUL-2021*
63+ raw_year_span = b_elem .text .strip ().split ()
64+ start_year = raw_year_span [1 ].split ("-" )[- 1 ]
65+ end_year = raw_year_span [- 1 ].split ("-" )[- 1 ]
5866 if "UTC:" in b_elem :
5967 raw_time = b_elem .next_sibling
6068 # for non english equinix notifications
6169 # english section is usually at the bottom
6270 # this skips the non english line at the top
6371 if not self ._isascii (raw_time ):
6472 continue
73+
74+ # Expected Format *UTC:* FRIDAY, 02 JUL 10:00 - FRIDAY, 02 JUL 15:00
75+ # Note this detailed time does not contain the year..
6576 start_end_time = raw_time .split ("-" )
6677 if len (start_end_time ) == 2 :
67- data ["start" ] = self .dt2ts (parser .parse (raw_time . split ( "-" ) [0 ].strip ()))
68- data ["end" ] = self .dt2ts (parser .parse (raw_time . split ( "-" ) [1 ].strip ()))
78+ data ["start" ] = self .dt2ts (parser .parse (start_end_time [0 ].strip () + f" { start_year } " ))
79+ data ["end" ] = self .dt2ts (parser .parse (start_end_time [1 ].strip () + f" { end_year } " ))
6980 # all circuits in the notification share the same impact
7081 if "IMPACT:" in b_elem :
7182 impact_line = b_elem .next_sibling
0 commit comments