Lukazlim: Replace dependency requests with httpx (#12744)
* Replace dependency `requests` with `httpx` Fixes #12742 Signed-off-by: Lim, Lukaz Wei Hwang <lukaz.wei.hwang.lim@intel.com> * updating DIRECTORY.md * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Signed-off-by: Lim, Lukaz Wei Hwang <lukaz.wei.hwang.lim@intel.com> Co-authored-by: Lim, Lukaz Wei Hwang <lukaz.wei.hwang.lim@intel.com> Co-authored-by: cclauss <cclauss@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -3,9 +3,17 @@ CAUTION: You may get a json.decoding error.
|
||||
This works for some of us but fails for others.
|
||||
"""
|
||||
|
||||
# /// script
|
||||
# requires-python = ">=3.13"
|
||||
# dependencies = [
|
||||
# "httpx",
|
||||
# "rich",
|
||||
# ]
|
||||
# ///
|
||||
|
||||
from datetime import UTC, date, datetime
|
||||
|
||||
import requests
|
||||
import httpx
|
||||
from rich import box
|
||||
from rich import console as rich_console
|
||||
from rich import table as rich_table
|
||||
@@ -57,7 +65,7 @@ def get_forbes_real_time_billionaires() -> list[dict[str, int | str]]:
|
||||
Returns:
|
||||
List of top 10 realtime billionaires data.
|
||||
"""
|
||||
response_json = requests.get(API_URL, timeout=10).json()
|
||||
response_json = httpx.get(API_URL, timeout=10).json()
|
||||
return [
|
||||
{
|
||||
"Name": person["personName"],
|
||||
|
||||
Reference in New Issue
Block a user