feat(tames) add email parser for casemail notifications#1812
feat(tames) add email parser for casemail notifications#1812MorganBennetDev merged 6 commits intomainfrom
Conversation
75a47c4 to
50963eb
Compare
| ) | ||
| from juriscraper.state.texas.supreme_court import TexasSupremeCourtScraper | ||
| from tests import TESTS_ROOT_EXAMPLES_STATES | ||
| from tests import TESTS_ROOT_EXAMPLES_STATES, Path |
There was a problem hiding this comment.
Please import this from pathlib.
| if not link: | ||
| return default | ||
| case_number = parse_qs(urlparse(link).query)["cn"][0] | ||
| return {"url": link, "case_number": case_number} |
There was a problem hiding this comment.
Can you create a parser like juriscraper/scotus/scotus_email.py?
| self.parse_files(path_root, "*.html", TexasCourtOfAppealsScraper) | ||
|
|
||
|
|
||
| class TamesEmailParsingTest(unittest.TestCase): |
There was a problem hiding this comment.
If we create a parser like we did for SCOTUS, we can use the existing test infrastructure instead of creating a custom special case.
50963eb to
68d5196
Compare
|
Refactored the SCOTUSEmail parser to inherit from a base class that does some of the common email parsing work. It exposes a Totally open to revising this base class. Also open to planning on revising it after we've looked at a couple more notification emails. |
There was a problem hiding this comment.
Could we just create a method to get the first text/html non-multipart content part from an email and turn it into an lxml tree? Then we could use that method in the SCOTUS and TAMES email parsers (and potentially future ones) to avoid duplicating code. Right now a whole base class feels like premature abstraction.
There was a problem hiding this comment.
Sounds good to me.
|
@Brennan-Chesley-FLP There have been no new changes since the last review. |
5dba066 to
348de68
Compare
348de68 to
8af6f4f
Compare
Nothing 4 or 5 |
MorganBennetDev
left a comment
There was a problem hiding this comment.
Thank you for the changes. Just some minor tweaks and this should be good to go. Also, don't forget to update CHANGES.md.
| ) | ||
| return | ||
|
|
||
| court_name = subject[len(SUBJECT_PREFIX) :] |
There was a problem hiding this comment.
Please use removeprefix for clarity.
| url: str | ||
|
|
||
|
|
||
| class TamesEmail: |
There was a problem hiding this comment.
This should extend AbstractParser until we come up with a better approach.
|
I think the latest should cover the minor tweaks you suggested. |
|
@Brennan-Chesley-FLP Please update the changelog so this can auto-merge. |
No description provided.