-
Notifications
You must be signed in to change notification settings - Fork 36
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
Scrape categories and topics for news.py
#215
base: dev
Are you sure you want to change the base?
Conversation
Replace existing hard-coded news categories and topics with helper functions that scrape these values. The values are scraped when the user calls a function from the news module for the first time, and the scraped values are reused in all subsequent function calls.
Rewrite news.py to cache categories and topics using the functools @cache decorator rather than global variables
Pipfile.lock
Outdated
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.
Are these version changes needed? You bump up the minimum Python version
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.
Most of them aren't necessary, but the jinja2
version change is necessary as a security update (the repo current has 4 Dependabot alerts for security vulnerabilities in the current jinja2
version). I had simply run pipenv update
when I was making my changes for this PR.
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.
Make the dependency changes in a different PR
|
||
topics = news.get_topics() | ||
|
||
self.assertCountEqual( |
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.
Is this test going to hold true even into the future?
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.
Yes, all the tests for the news
module are mocked. The mock files are in the tests/samples
directory.
Revert dependency updates in Pipfile.lock and requirements.txt. The updates will be left for a separate PR.
Fixes #204
Replace existing hard-coded news categories and topics with helper functions that scrape these values. The values are scraped when the user calls a function from the news module for the first time, and the scraped values are reused in all subsequent function calls.