-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
78 additions
and
7 deletions.
There are no files selected for viewing
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import logging | ||
import re | ||
|
||
from bs4 import BeautifulSoup | ||
from ..const import EMAIL_ATTR_BODY | ||
|
||
|
||
_LOGGER = logging.getLogger(__name__) | ||
ATTR_ADAFRUIT = 'adafruit' | ||
EMAIL_DOMAIN_ADAFRUIT = 'adafruit.com' | ||
|
||
|
||
def parse_adafruit(email): | ||
"""Parse Adafruit tracking numbers.""" | ||
tracking_numbers = [] | ||
|
||
matches = re.findall(r'Delivery Confirmation ID is (.*?) ', email[EMAIL_ATTR_BODY]) | ||
for tracking_number in matches: | ||
if tracking_number not in tracking_numbers: | ||
tracking_numbers.append(tracking_number) | ||
|
||
return tracking_numbers |
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
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
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import logging | ||
import re | ||
|
||
from bs4 import BeautifulSoup | ||
from ..const import EMAIL_ATTR_BODY | ||
|
||
|
||
_LOGGER = logging.getLogger(__name__) | ||
ATTR_SYLVANE = 'sylvane' | ||
EMAIL_DOMAIN_SYLVANE = 'sylvane.com' | ||
|
||
|
||
def parse_sylvane(email): | ||
"""Parse Sylvane tracking numbers.""" | ||
tracking_numbers = [] | ||
|
||
soup = BeautifulSoup(email[EMAIL_ATTR_BODY], 'html.parser') | ||
links = [link.get('href') for link in soup.find_all('a')] | ||
for link in links: | ||
if not link: | ||
continue | ||
match = re.search('trknbr=(.*?)$', link) | ||
if match and match.group(1) not in tracking_numbers: | ||
tracking_numbers.append(match.group(1)) | ||
|
||
return tracking_numbers |
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
Empty file.