1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-02 07:07:46 +00:00

updates based on jt's capture fix

This commit is contained in:
Darren Schroeder 2022-01-12 06:42:52 -06:00
parent 77847a6c65
commit 8a8ec3b2ad

View file

@ -41,26 +41,17 @@ def get_my_location [index: int] {
} }
} }
# we should be able to put these here but there's a bug in e-q where let URL_QUERY_LOCATION = "https://api.openweathermap.org/geo/1.0/direct"
# they're not visible let TOKEN = "85a4e3c55b73909f42c6a23ec35b7147"
# let URL_QUERY_LOCATION = "https://api.openweathermap.org/geo/1.0/direct" let URL_WEATHER = "https://api.openweathermap.org/data/2.5/weather"
# let TOKEN = "85a4e3c55b73909f42c6a23ec35b7147"
# let URL_WEATHER = "https://api.openweathermap.org/data/2.5/weather"
def get_location_by_ip [locIdx: int] { def get_location_by_ip [locIdx: int] {
let URL_QUERY_LOCATION = "https://api.openweathermap.org/geo/1.0/direct"
let TOKEN = "85a4e3c55b73909f42c6a23ec35b7147"
let location = (get_my_location $locIdx) let location = (get_my_location $locIdx)
let url = $"($URL_QUERY_LOCATION)?q=($location)&limit=5&appid=($TOKEN)" let url = $"($URL_QUERY_LOCATION)?q=($location)&limit=5&appid=($TOKEN)"
fetch $url fetch $url
} }
def get_weather_by_ip [locIdx: int, units: string] { def get_weather_by_ip [locIdx: int, units: string] {
let URL_WEATHER = "https://api.openweathermap.org/data/2.5/weather"
let TOKEN = "85a4e3c55b73909f42c6a23ec35b7147"
# units # units
# f = imperial aka Fahrenheit # f = imperial aka Fahrenheit
# c = metric aka Celcius # c = metric aka Celcius