There was an error while loading. Please reload this page.
1 parent ef2a48c commit ad58cdcCopy full SHA for ad58cdc
1 file changed
web_programming/crypto_price.py
@@ -9,7 +9,7 @@
9
# ]
10
# ///
11
12
-import httpx2
+from httpx2 import get
13
14
COINGECKO_URL = (
15
"https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=usd"
@@ -18,11 +18,7 @@
18
19
def get_eth_price_usd() -> float:
20
"""Fetch the current ETH price in USD."""
21
- return (
22
- httpx2.get(COINGECKO_URL, timeout=10)
23
- .raise_for_status()
24
- .json()["ethereum"]["usd"]
25
- )
+ return get(COINGECKO_URL, timeout=10).raise_for_status().json()["ethereum"]["usd"]
26
27
28
def eth_to_usd(eth_amount: float) -> float:
0 commit comments