File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 11"""Interact with the Real Python feed."""
22# Standard library imports
3- from typing import Dict , List # noqa
3+ from typing import Dict , List
44
55# Third party imports
66import feedparser
@@ -21,8 +21,17 @@ def _feed(url: str = URL) -> feedparser.FeedParserDict:
2121
2222def get_site (url : str = URL ) -> str :
2323 """Get name and link to website of the feed."""
24- info = _feed (url ).feed
25- return f"{ info .title } ({ info .link } )"
24+ info = _feed (url )
25+ if exception := info .get ("bozo_exception" ):
26+ message = f"Could not read feed at { url } "
27+ if "CERTIFICATE_VERIFY_FAILED" in str (exception ):
28+ message += (
29+ ".\n \n You may need to manually install certificates by running "
30+ "`Install Certificates` in your Python installation folder. "
31+ "See https://realpython.com/installing-python/"
32+ )
33+ raise SystemExit (message )
34+ return f"{ info .feed .title } ({ info .feed .link } )"
2635
2736
2837def get_article (article_id : str , links : bool = False , url : str = URL ) -> str :
You can’t perform that action at this time.
0 commit comments