Skip to content

Commit

Permalink
Merge pull request #80 from networktocode/release-v2.0.1
Browse files Browse the repository at this point in the history
Release v2.0.1
  • Loading branch information
chadell authored Sep 16, 2021
2 parents 1992402 + 4d9b7cc commit 8784032
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v2.0.1 - 2021-09-16

### Fixed

- #79 - Fix `HtmlParserGTT1` regex parsing.

## v2.0.0 - 2021-09-15

### Added
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ The library is available as a Python package in pypi and can be installed with p
## Python Library

```python
from circuit_maintenance_parser import init_provider, init_data_raw
from circuit_maintenance_parser import init_provider, NotificationData

raw_data = b"""BEGIN:VCALENDAR
VERSION:2.0
Expand All @@ -99,7 +99,7 @@ END:VCALENDAR

ntt_provider = init_provider("ntt")

data_to_process = init_data_raw("ical", raw_data)
data_to_process = NotificationData.init_from_raw("ical", raw_data)

maintenances = ntt_provider.get_maintenances(data_to_process)

Expand Down
25 changes: 13 additions & 12 deletions circuit_maintenance_parser/parsers/gtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,19 @@ def parse_tables(self, tables, data):
# Group 1 matches the maintenance ID
# Group 2 matches the status of the notification
groups = re.search(r".+: ([0-9]+) - ([A-Z][a-z]+)", td_element.text.strip())
data["maintenance_id"] = groups.groups()[0]
status = groups.groups()[1]
if status == "Reminder":
data["status"] = Status["CONFIRMED"]
elif status == "Update":
data["status"] = Status["RE_SCHEDULED"]
elif status == "Cancelled":
data["status"] = Status["CANCELLED"]
# When a email is cancelled there is no start or end time specificed
# Setting this to 0 and 1 stops any errors from pydantic
data["start"] = 0
data["end"] = 1
if groups:
data["maintenance_id"] = groups.groups()[0]
status = groups.groups()[1]
if status == "Reminder":
data["status"] = Status["CONFIRMED"]
elif status == "Update":
data["status"] = Status["RE_SCHEDULED"]
elif status == "Cancelled":
data["status"] = Status["CANCELLED"]
# When a email is cancelled there is no start or end time specificed
# Setting this to 0 and 1 stops any errors from pydantic
data["start"] = 0
data["end"] = 1
elif "Start" in td_element.text:
start = parser.parse(td_element.next_sibling.next_sibling.text)
data["start"] = self.dt2ts(start)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "circuit-maintenance-parser"
version = "2.0.0"
version = "2.0.1"
description = "Python library to parse Circuit Maintenance notifications and return a structured data back"
authors = ["Network to Code <[email protected]>"]
license = "Apache-2.0"
Expand Down

0 comments on commit 8784032

Please sign in to comment.