From 0a6bce5e99e0b93078d6e737ea86091c29737f5d Mon Sep 17 00:00:00 2001 From: Jon C Date: Sun, 1 Feb 2026 01:08:05 +0100 Subject: [PATCH] coin-gecko: Add user-agent to requests #### Problem The public Coin Gecko API isn't working with an error of: ``` {"status":{"error_code":403,"error_message":"Please add a descriptive User-Agent to your request. For higher rate limits & stable integration, please subscribe to our API plans: https://www.coingecko.com/en/api/pricing . If you think this is a mistake, please report here: https://forms.gle/3V2z8Mb3k2RMu5S2A"}} ``` #### Summary of changes Add a user-agent of "sys" so the requests work. --- src/coin_gecko.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/coin_gecko.rs b/src/coin_gecko.rs index 1e926cb..5d2a479 100644 --- a/src/coin_gecko.rs +++ b/src/coin_gecko.rs @@ -127,7 +127,8 @@ pub async fn get_current_price(token: &MaybeToken) -> Result, } - let coins = reqwest::get(url).await?.json::().await?; + let client = reqwest::Client::builder().user_agent("sys").build()?; + let coins = client.get(url).send().await?.json::().await?; coins .solana @@ -184,7 +185,10 @@ pub async fn get_historical_price( when.year() ); - reqwest::get(url) + let client = reqwest::Client::builder().user_agent("sys").build()?; + client + .get(url) + .send() .await? .json::() .await?