Skip to content
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

Completely rewrite news.py and unit tests #203

Merged
merged 1 commit into from
Aug 25, 2024
Merged

Conversation

tianyizheng02
Copy link
Contributor

@tianyizheng02 tianyizheng02 commented Aug 20, 2024

Fixes #128, fixes #166

Rewrite the news module because the underlying news API has been dead for years. The rewritten news.py scrapes the Pittwire website for official Pitt news articles. The rewritten unit tests for news.py mocks API requests and achieves 100% code coverage with pytest.

Rewrite the news module because the underlying news API has been dead
for years. The rewritten news.py scrapes the Pittwire website for
official Pitt news articles. The rewritten unit tests for news.py mocks
API requests and achieves 100% code coverage with pytest.
)
PITT_BASE_URL = "https://www.pitt.edu"

Category = Literal["features-articles", "accolades-honors", "ones-to-watch", "announcements-and-updates"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are the categories and topics hard-coded? These will probably change over time right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, Pittwire might add/remove topics over time (though I suspect that the categories are much less likely to change). We could scrape the lists of categories and topics so that they don't need to be hard-coded, but that'll break if the website layout changes too drastically. If you feel like that's a better alternative, we can do that in a separate PR. Otherwise, we'll just need to keep an eye on the Pittwire website occasionally to make sure that the lists are up-to-date.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should scrape it. We have no idea what the maintenance of this repo will look like over time. It's certainly had its lulls over time, so let's make it withstand the lack of us

pittapi/news.py Show resolved Hide resolved
@tianyizheng02 tianyizheng02 merged commit e1589e2 into dev Aug 25, 2024
4 checks passed
@tianyizheng02 tianyizheng02 deleted the rewrite-news branch December 20, 2024 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Non-mocked tests should be mocked Any API using m.pitt.edu are dead, new scrapers needed!
3 participants