• openweathermap - update for one call 3.0

    From Nigel Reed@1:103/705 to GitLab issue in main/sbbs on Fri Apr 19 09:58:06 2024
    open https://gitlab.synchro.net/main/sbbs/-/issues/747

    owm just announced that they are migrating from API version 2.5 to 3.0 so openweathermap.js will need to be updated accordingly.

    It appears 3.0 is backwards compatible with 2.5 and also adds some new features.
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Nigel Reed@1:103/705 to GitLab note in main/sbbs on Fri Apr 19 09:58:50 2024
    https://gitlab.synchro.net/main/sbbs/-/issues/747#note_5278

    https://openweathermap.org/one-call-transfer
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From echicken@1:103/705 to GitLab note in main/sbbs on Tue Apr 23 21:03:08 2024
    https://gitlab.synchro.net/main/sbbs/-/issues/747#note_5291

    One Call API requires a subscription, and billing information in case you go over the limit. (They used to just cut off 'free' tier users for the day when that happened.)

    The backward compatibility seems a bit iffy despite what the blurb on their site may say, but their docs were always a bit vague. What I'm reading makes it seem as though the response structure is a bit different, as may be the requests. I can't test/verify this without giving them my credit card number.

    If there's a free alternative out there somewhere, I think we'd be better off switching to it.
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Nigel Reed@1:103/705 to GitLab note in main/sbbs on Tue Apr 23 23:31:40 2024
    https://gitlab.synchro.net/main/sbbs/-/issues/747#note_5292

    I've looked at a bunch of APIs and none of them seem to offer the features that OWM does. I've looked through my settings and I don't even see where I have entered a credit card number. Plus, you can set a daily limit so you won't go over and very much doubt any BBS is going to do 1000 hits per day, unless there's a malicious user.

    ![image](/uploads/204a9935d87e24b78f81a54bff662691/image.png)
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Nigel Reed@1:103/705 to GitLab note in main/sbbs on Tue Apr 23 23:36:32 2024
    https://gitlab.synchro.net/main/sbbs/-/issues/747#note_5293

    I just changed openweathermap.js from 2.5 to 3.0 and tested my weather script and it seemed to return results ok. Will need some more through testing but seems like there's no difference.
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From echicken@1:103/705 to GitLab note in main/sbbs on Wed Apr 24 06:36:16 2024
    https://gitlab.synchro.net/main/sbbs/-/issues/747#note_5294

    All I did was update the `url` line in the library to this:

    ```js
    var url = 'http://api.openweathermap.org/data/3.0/onecall?' + endpoint;
    ```

    Is yours the same? I ran a test script and got this response:

    ```json
    {"cod":401,"message":"Please note that using One Call 3.0 requires a separate subscription to the One Call by Call plan. Learn more here https://openweathermap.org/price. If you have a valid subscription to the One Call by Call plan, but still receive this error, then please see https://openweathermap.org/faq#error401 for more info."}
    ```

    I definitely can't go any further without providing billing info on their site.

    If it works properly for you, then we may as well update the library; It'll break in less than 8 weeks anyhow. I'm just not going to throw a bunch of work at updating this thing (and tell sysops that they need to provide a CC and configure usage limits) unless there's really nothing roughly equivalent out there.

    (We do have a wttr.in thing, which is not really the same but is at least an available alternative for weather info.)
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Nigel Reed@1:103/705 to GitLab note in main/sbbs on Wed Apr 24 09:44:36 2024
    https://gitlab.synchro.net/main/sbbs/-/issues/747#note_5296

    curl 'wttr.in/plano,tx?format=j1'

    OK, this provides a huge amount of data. Probably everything that is needed. I guess we could keep owm and change to 3.0 for those who want to use it and a wttr interface for those who want to try something different.

    No API key required either.
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Nigel Reed@1:103/705 to GitLab note in main/sbbs on Wed Apr 24 09:31:26 2024
    https://gitlab.synchro.net/main/sbbs/-/issues/747#note_5295

    Yes, that's what I put in. Maybe I did enter a credit card long ago, or maybe it's a new requirement. I'm not sure. I'd be happy to use another API but finding one that provides all the details you get with OWM might be a struggle, especially in one call.
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From echicken@1:103/705 to GitLab note in main/sbbs on Wed Apr 24 09:52:42 2024
    https://gitlab.synchro.net/main/sbbs/-/issues/747#note_5297

    There is a module at xtrn/wttr.in which applies some pre-selected options, and it could be customized further. I added that a year or two ago.

    So far I can only get openweathermap.js to work if I change line 71 to this:

    ```js
    var url = 'http://api.openweathermap.org/data/3.0/' + endpoint;
    ```

    and then only if the endpoint specified by the caller is 'onecall'. (I'm mildly suspicious that you might still be loading the old version of the library somehow - I'm not sure how it just works for you.)

    I may just add a `call_api_v3' method for now so that existing scripts will keep working for the next two months, and anything that wants to use the new API can do this instead.
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Nigel Reed@1:103/705 to GitLab note in main/sbbs on Thu Apr 25 10:01:04 2024
    https://gitlab.synchro.net/main/sbbs/-/issues/747#note_5298

    Rather than being in xtrn, wouldn't it be better to convert wttr.in it to a loadable js that can be put in exec/load ?

    That said, with it being a simple fetch, there's no reason why the author can't use http.js to get the url themselves and parse the json. It's easy enough. (which is quite a bold statement for me to make).
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)