Skip to content

Commit 8784032

Browse files
author
Christian Adell
authored
Merge pull request #80 from networktocode/release-v2.0.1
Release v2.0.1
2 parents 1992402 + 4d9b7cc commit 8784032

File tree

4 files changed

+22
-15
lines changed

4 files changed

+22
-15
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## v2.0.1 - 2021-09-16
4+
5+
### Fixed
6+
7+
- #79 - Fix `HtmlParserGTT1` regex parsing.
8+
39
## v2.0.0 - 2021-09-15
410

511
### Added

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ The library is available as a Python package in pypi and can be installed with p
7373
## Python Library
7474

7575
```python
76-
from circuit_maintenance_parser import init_provider, init_data_raw
76+
from circuit_maintenance_parser import init_provider, NotificationData
7777

7878
raw_data = b"""BEGIN:VCALENDAR
7979
VERSION:2.0
@@ -99,7 +99,7 @@ END:VCALENDAR
9999

100100
ntt_provider = init_provider("ntt")
101101

102-
data_to_process = init_data_raw("ical", raw_data)
102+
data_to_process = NotificationData.init_from_raw("ical", raw_data)
103103

104104
maintenances = ntt_provider.get_maintenances(data_to_process)
105105

circuit_maintenance_parser/parsers/gtt.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,19 @@ def parse_tables(self, tables, data):
3030
# Group 1 matches the maintenance ID
3131
# Group 2 matches the status of the notification
3232
groups = re.search(r".+: ([0-9]+) - ([A-Z][a-z]+)", td_element.text.strip())
33-
data["maintenance_id"] = groups.groups()[0]
34-
status = groups.groups()[1]
35-
if status == "Reminder":
36-
data["status"] = Status["CONFIRMED"]
37-
elif status == "Update":
38-
data["status"] = Status["RE_SCHEDULED"]
39-
elif status == "Cancelled":
40-
data["status"] = Status["CANCELLED"]
41-
# When a email is cancelled there is no start or end time specificed
42-
# Setting this to 0 and 1 stops any errors from pydantic
43-
data["start"] = 0
44-
data["end"] = 1
33+
if groups:
34+
data["maintenance_id"] = groups.groups()[0]
35+
status = groups.groups()[1]
36+
if status == "Reminder":
37+
data["status"] = Status["CONFIRMED"]
38+
elif status == "Update":
39+
data["status"] = Status["RE_SCHEDULED"]
40+
elif status == "Cancelled":
41+
data["status"] = Status["CANCELLED"]
42+
# When a email is cancelled there is no start or end time specificed
43+
# Setting this to 0 and 1 stops any errors from pydantic
44+
data["start"] = 0
45+
data["end"] = 1
4546
elif "Start" in td_element.text:
4647
start = parser.parse(td_element.next_sibling.next_sibling.text)
4748
data["start"] = self.dt2ts(start)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "circuit-maintenance-parser"
3-
version = "2.0.0"
3+
version = "2.0.1"
44
description = "Python library to parse Circuit Maintenance notifications and return a structured data back"
55
authors = ["Network to Code <[email protected]>"]
66
license = "Apache-2.0"

0 commit comments

Comments
 (0)