From b09b60cc434bb9be05ce2bbb6dc299760d13b18b Mon Sep 17 00:00:00 2001 From: Luca Scherzer <83914554+lucascherzer@users.noreply.github.com> Date: Tue, 8 Jul 2025 13:40:09 +0200 Subject: [PATCH] fix: url encoding (#1142) The Wolframalpha API call would previously throw an error due to an incorrect layout of the input data to the url encoding step. This commit fixes it --- sourced/api_wrappers/wolframalpha.nu | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sourced/api_wrappers/wolframalpha.nu b/sourced/api_wrappers/wolframalpha.nu index babc1d9..aa2d676 100644 --- a/sourced/api_wrappers/wolframalpha.nu +++ b/sourced/api_wrappers/wolframalpha.nu @@ -1,19 +1,19 @@ -let appID = "" #YOUR APP_ID +let appID = $env.WOLFRAMALPHA_APPID #Fetch simple answer from WolframAlpha API -def wolfram [...query #Your query +def wolfram [...query ] { let query_string = ($query | str join " ") - let result = (http get ("https://api.wolframalpha.com/v1/result?" + ([[appid i]; [$appID $query_string]] | url build-query))) + let result = (http get ("https://api.wolframalpha.com/v1/result?" + ([[key value]; [appid $appID] [i $query_string]] | url build-query))) $result + "" } #Fetch image with full answer from WolframAlpha API -def wolframimg [...query #Your query +def wolframimg [...query ] { let query_string = ($query | str join " ") let filename = ($query_string + ".png") - let link = ("https://api.wolframalpha.com/v1/simple?" + ([[appid i]; [$appID $query_string]] | url build-query) + "&background=F5F5F5&fontsize=20") + let link = ("https://api.wolframalpha.com/v1/simple?" + ([[key value]; [appid $appID] [i $query_string]] | url build-query) + "&background=F5F5F5&fontsize=20") http get $link | save $filename echo ("Query result saved in file: " + $filename) }