| View previous topic :: View next topic |
| Author |
Message |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sun Feb 20, 2022 2:51 pm Post subject: |
|
|
| Code: | | https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/${arg}/next5days?key=YOUR_API_KEY |
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
bayo Voice
Joined: 25 Jan 2022 Posts: 13
|
Posted: Mon Feb 21, 2022 4:43 pm Post subject: |
|
|
Hi. It doesn't work. Says
Tcl error [::Visualcrossing::forecast_weather]: missing value to go with key
| Code: | ### The Third Proc for 3 days Forecast
proc ::Visualcrossing::forecast_weather {nick uhost hand chan arg} {
set forecast_data [::Visualcrossing::download_weather https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/${arg}/next3days?[http::formatQuery unitGroup metric key $::Visualcrossing::key]]
if {$arg == ""} { putserv "PRIVMSG $chan :Sintax: !3 location" ; return }
set forecast_dict [::json::json2dict $forecast_data]
set desc [dict get $forecast_data description]
putserv "PRIVMSG $chan :TEST $desc"
} |
|
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Mon Feb 21, 2022 6:44 pm Post subject: |
|
|
When error occures, use .set errorInfo to let us know if the trouble is with formatQuery or with json2dict.
I guess it's json2dict, so dump forecast_data then we can understand the trouble _________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Mon Feb 21, 2022 6:55 pm Post subject: Pasted code looks fine. |
|
|
Maybe this is the code it's bitching about: | Code: | | ?[http::formatQuery unitGroup metric key $::Visualcrossing::key] |
...but to me that chunk seems ok, though I might call http::formatQuery more correctly | Code: | | ?[::http::formatQuery unitGroup metric key $::Visualcrossing::key] |
It does fit the syntax from the manual | Quote: | | ::http::formatQuery key value ?key value ...? | as it seems to have an equal number of keys and values.
If that doesn't work, try:
| Code: | | set forecast_data [::Visualcrossing::download_weather https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/${arg}/next3days?unitGroup=metric&key=$::Visualcrossing::key] |
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
|