MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / fetch_bbc_news

Function fetch_bbc_news

web_programming/fetch_bbc_news.py:15–20  ·  view source on GitHub ↗
(bbc_news_api_key: str)

Source from the content-addressed store, hash-verified

13
14
15def fetch_bbc_news(bbc_news_api_key: str) -> None:
16 # fetching a list of articles in json format
17 bbc_news_page = httpx.get(_NEWS_API + bbc_news_api_key, timeout=10).json()
18 # each article in the list is a dict
19 for i, article in enumerate(bbc_news_page["articles"], 1):
20 print(f"{i}.) {article['title']}")
21
22
23if __name__ == "__main__":

Callers 1

fetch_bbc_news.pyFile · 0.85

Calls 2

jsonMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected