-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AWS Direct Parser #84
Conversation
circuit_maintenance_parser/parser.py
Outdated
def parser_hook(self, raw: bytes): | ||
"""Execute parsing.""" | ||
result = [] | ||
soup = bs4.BeautifulSoup(quopri.decodestring(raw), features="lxml") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this look like a Html parser? maybe we should add the text/plain
into that data_type. I see it too much HTML specific for a generic Text parser
maintenace_id += str(data["start"]) | ||
data["end"] = self.dt2ts(parser.parse(search.group(2))) | ||
if "may become unavailable" in line.lower(): | ||
impact = "DEGRADED" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unavailable = OUTAGE
_processors: List[GenericProcessor] = [ | ||
CombinedProcessor(data_parsers=[EmailDateParser, TextParserAWS1, SubjectParserAWS1]), | ||
] | ||
_default_organizer = "aaaaaaaaaaaaaaa" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is wrong
tests/unit/data/aws/aws1_result.json
Outdated
], | ||
"end": 1621519200, | ||
"maintenance_id": "21264c558a1b6a2bedaae0878d6318b0", | ||
"organizer": "aaaaaaaaaaaaaaa", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong
circuit_maintenance_parser/parser.py
Outdated
"""Execute parsing.""" | ||
result = [] | ||
soup = bs4.BeautifulSoup(quopri.decodestring(raw), features="lxml") | ||
# Even we have not noticed any HTML notification with more than one maintenance yet, we define the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not true :) , we have Sparkle
circuit_maintenance_parser/parser.py
Outdated
|
||
|
||
class Text(Parser): | ||
"""Html parser.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
if "may become unavailable" in line.lower(): | ||
impact = Impact.OUTAGE | ||
elif "has been cancelled" in line.lower(): | ||
impact = Impact.NO_IMPACT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not change the impact type, even Cancelled
…tenance-parser into kc_aws_parser
circuit_maintenance_parser/parser.py
Outdated
return result | ||
|
||
@staticmethod | ||
def get_text_hook(raw): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def get_text_hook(raw): | |
def get_text_hook(raw: bytes) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (update changelog and add a note for the maintenance_id
hash point for future reference)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work @carbonarok !
Parser for AWS notifications