mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-06 18:49:26 +08:00
Enable ruff S113 rule (#11375)
* Enable ruff S113 rule * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@ -5,7 +5,7 @@ import requests
|
||||
|
||||
def get_hackernews_story(story_id: str) -> dict:
|
||||
url = f"https://hacker-news.firebaseio.com/v0/item/{story_id}.json?print=pretty"
|
||||
return requests.get(url).json()
|
||||
return requests.get(url, timeout=10).json()
|
||||
|
||||
|
||||
def hackernews_top_stories(max_stories: int = 10) -> list[dict]:
|
||||
@ -13,7 +13,7 @@ def hackernews_top_stories(max_stories: int = 10) -> list[dict]:
|
||||
Get the top max_stories posts from HackerNews - https://news.ycombinator.com/
|
||||
"""
|
||||
url = "https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty"
|
||||
story_ids = requests.get(url).json()[:max_stories]
|
||||
story_ids = requests.get(url, timeout=10).json()[:max_stories]
|
||||
return [get_hackernews_story(story_id) for story_id in story_ids]
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user