-
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
issue #59: Take Stamp
from Email Date
#59
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6b55177
Add EmailDate parser
chadell 021f3cf
Add new EmailDateParser with testing and make most of HTML provider C…
chadell 7d9fa87
Fix typing for mktime_tz
chadell 4e41e54
Make Stamp mandatory to create a Maintenance
chadell 404a56b
Update Changelog
chadell 5cd56c1
Merge remote-tracking branch 'origin/develop' into issue-56-stamp-parser
chadell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
import json | ||
from enum import Enum | ||
|
||
from typing import List, Optional | ||
from typing import List | ||
|
||
from pydantic import BaseModel, validator, StrictStr, StrictInt, Extra | ||
|
||
|
@@ -99,10 +99,10 @@ class Maintenance(BaseModel, extra=Extra.forbid): | |
status: defines the overall status or confirmation for the maintenance | ||
start: timestamp that defines the start date of the maintenance in GMT | ||
end: timestamp that defines the end date of the maintenance in GMT | ||
stamp: timestamp that defines the update date of the maintenance in GMT | ||
organizer: defines the contact information included in the original notification | ||
|
||
Optional attributes: | ||
stamp: timestamp that defines the update date of the maintenance in GMT | ||
summary: description of the maintenace notification | ||
uid: specific unique identifier for each notification | ||
sequence: sequence number - initially zero - to serialize updates in case they are received or processed out of | ||
|
@@ -123,7 +123,7 @@ class Maintenance(BaseModel, extra=Extra.forbid): | |
... summary="This is a maintenance notification", | ||
... uid="1111", | ||
... ) | ||
Maintenance(provider='A random NSP', account='12345000', maintenance_id='VNOC-1-99999999999', circuits=[CircuitImpact(circuit_id='123', impact=<Impact.NO_IMPACT: 'NO-IMPACT'>), CircuitImpact(circuit_id='456', impact=<Impact.OUTAGE: 'OUTAGE'>)], status=<Status.COMPLETED: 'COMPLETED'>, start=1533704400, end=1533712380, organizer='[email protected]', stamp=1533595768, uid='1111', sequence=1, summary='This is a maintenance notification') | ||
Maintenance(provider='A random NSP', account='12345000', maintenance_id='VNOC-1-99999999999', circuits=[CircuitImpact(circuit_id='123', impact=<Impact.NO_IMPACT: 'NO-IMPACT'>), CircuitImpact(circuit_id='456', impact=<Impact.OUTAGE: 'OUTAGE'>)], status=<Status.COMPLETED: 'COMPLETED'>, start=1533704400, end=1533712380, stamp=1533595768, organizer='[email protected]', uid='1111', sequence=1, summary='This is a maintenance notification') | ||
""" | ||
|
||
provider: StrictStr | ||
|
@@ -133,11 +133,10 @@ class Maintenance(BaseModel, extra=Extra.forbid): | |
status: Status | ||
start: StrictInt | ||
end: StrictInt | ||
stamp: StrictInt | ||
organizer: StrictStr | ||
|
||
# Non mandatory attributes | ||
|
||
stamp: Optional[StrictInt] = None | ||
uid: StrictStr = "0" | ||
sequence: StrictInt = 1 | ||
summary: StrictStr = "" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,9 +10,9 @@ | |
|
||
from circuit_maintenance_parser.output import Maintenance | ||
from circuit_maintenance_parser.data import NotificationData | ||
from circuit_maintenance_parser.parser import ICal | ||
from circuit_maintenance_parser.parser import ICal, EmailDateParser | ||
from circuit_maintenance_parser.errors import ProcessorError, ProviderError | ||
from circuit_maintenance_parser.processor import SimpleProcessor, GenericProcessor | ||
from circuit_maintenance_parser.processor import CombinedProcessor, SimpleProcessor, GenericProcessor | ||
|
||
from circuit_maintenance_parser.parsers.cogent import HtmlParserCogent1 | ||
from circuit_maintenance_parser.parsers.gtt import HtmlParserGTT1 | ||
|
@@ -100,7 +100,7 @@ class Cogent(GenericProvider): | |
"""Cogent provider custom class.""" | ||
|
||
_processors: List[GenericProcessor] = [ | ||
SimpleProcessor(data_parsers=[HtmlParserCogent1]), | ||
CombinedProcessor(data_parsers=[EmailDateParser, HtmlParserCogent1]), | ||
] | ||
_default_organizer = "[email protected]" | ||
|
||
|
@@ -115,7 +115,7 @@ class GTT(GenericProvider): | |
"""GTT provider custom class.""" | ||
|
||
_processors: List[GenericProcessor] = [ | ||
SimpleProcessor(data_parsers=[HtmlParserGTT1]), | ||
CombinedProcessor(data_parsers=[EmailDateParser, HtmlParserGTT1]), | ||
] | ||
_default_organizer = "[email protected]" | ||
|
||
|
@@ -124,7 +124,7 @@ class Lumen(GenericProvider): | |
"""Lumen provider custom class.""" | ||
|
||
_processors: List[GenericProcessor] = [ | ||
SimpleProcessor(data_parsers=[HtmlParserLumen1]), | ||
CombinedProcessor(data_parsers=[EmailDateParser, HtmlParserLumen1]), | ||
] | ||
_default_organizer = "[email protected]" | ||
|
||
|
@@ -133,7 +133,7 @@ class Megaport(GenericProvider): | |
"""Megaport provider custom class.""" | ||
|
||
_processors: List[GenericProcessor] = [ | ||
SimpleProcessor(data_parsers=[HtmlParserMegaport1]), | ||
CombinedProcessor(data_parsers=[EmailDateParser, HtmlParserMegaport1]), | ||
] | ||
_default_organizer = "[email protected]" | ||
|
||
|
@@ -161,7 +161,7 @@ class Telstra(GenericProvider): | |
|
||
_processors: List[GenericProcessor] = [ | ||
SimpleProcessor(data_parsers=[ICal]), | ||
SimpleProcessor(data_parsers=[HtmlParserTelstra1]), | ||
CombinedProcessor(data_parsers=[EmailDateParser, HtmlParserTelstra1]), | ||
] | ||
_default_organizer = "[email protected]" | ||
|
||
|
@@ -170,7 +170,7 @@ class Turkcell(GenericProvider): | |
"""Turkcell provider custom class.""" | ||
|
||
_processors: List[GenericProcessor] = [ | ||
SimpleProcessor(data_parsers=[HtmlParserTurkcell1]), | ||
CombinedProcessor(data_parsers=[EmailDateParser, HtmlParserTurkcell1]), | ||
] | ||
_default_organizer = "[email protected]" | ||
|
||
|
@@ -179,7 +179,7 @@ class Verizon(GenericProvider): | |
"""Verizon provider custom class.""" | ||
|
||
_processors: List[GenericProcessor] = [ | ||
SimpleProcessor(data_parsers=[HtmlParserVerizon1]), | ||
CombinedProcessor(data_parsers=[EmailDateParser, HtmlParserVerizon1]), | ||
] | ||
_default_organizer = "[email protected]" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Mon, 1 Feb 2021 09:33:34 +0000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[ | ||
{ | ||
"stamp": 1612172014 | ||
} | ||
] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 method only support specific formats of dates?
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.
Only supports Email Date format