Open blakeNaccarato opened 1 year ago
I know I opened this awhile ago, I had occasion to revisit this and figured I'd drop another breadcrumb. In my above comment I talk about modifying a URL in the repo, specifically I'm referring to this line in checkweather.py
:
where something like the following should work:
BASEURL = '
https://api.openweathermap.org/data/2.5/weather?lat={}&lon={}&exclude=minutely,daily,alerts&units={}&appid={}'
anyways, some other changes will probably be needed in the tutorial flow, but that sums it up. You won't be able to reproduce this locally if you're using an existing OpenWeatherMap account, you'll have to try to follow the tutorial flow with a brand new account to witness the breakage.
Just to follow up, I am working on this but it is a bigger fix than I hoped because the data available in the "weather" API is much less than the data that used to be available in the "onecall 2.5" API. I'm playing with various options. For anyone who wants to keep the current flow and is willing to give OpenWeather billing information, there are still 1000 free calls/day to the Onecall 3.0 API: https://api.openweathermap.org/data/3.0/onecall?lat={lat}&lon={lon}&exclude={part}&appid=[{API key}](https://home.openweathermap.org/api_keys)
The change is that to register for access requires payment information which was not the case in 2.5 unless you went over 1000 calls/day.
Ah, yeah that's understandably a bigger fix than just swapping the calls! I imagine that probably means a complete rewrite of some of the tutorial contents. It's a bummer that an API changing out from under you like that can create so much more work. Depending on the severity of the rewrite that is necessary, I wonder whether there are more stable weather data sources to base the tutorial on? It could probably be stabilized on a historical weather data source, but I understand the tutorial might end up less "awesome" if the user can't actually plot actual weather in their zip code that way.
Thanks for the heads up about the 1000 free calls per day for those brave enough to add a credit card 😅. I'll have to try that and see how many calls the tutorial consumes per run-through. Other options might be to introduce a "run once" flag into the notebooks/project, which guarantees the API will only be hit once, caching the pulled data for local use. Or to bundle an example weather dataset which ensures the example can always be run against the sample data. But of course I understand how those solutions sort of "miss the point", because the central thesis is to demonstrate how Matlab uses Python to talk to APIs.
In any case, thanks for the update!
Okay, I finally pushed my updates. Blake, if you get a chance to try them out an make sure they work for you before we close out this issue? I'm pretty hopeful I hunted down the bugs this time, though. The new version walks through building a real app to display your results, too.
Thanks for reaching out, I'm looking forward to trying it out. Wow, it's a big changeset! I appreciate the accessibility improvement of adding alt-text to images, I didn't realize you could test Matlab on GitHub Actions, that's pretty cool.
I'll try to run through the new material over the next few weeks and check in as I go along. I've been meaning to write up a quick-reference to version-controlled Matlab/Python projects for colleagues, but I'm on a new machine and I've been waiting till 2024a to reinstall Matlab and jump through the hoops.
See https://github.com/domoticz/domoticz/issues/5336#issuecomment-1245132310 for this problem affecting another project as well. Basically, only the following URL works for newly-created accounts:
this URL differs from the URL in the tutorial in that
onecall
is replaced withweather
. I think the URL above should work for old and new accounts alike.But this may break again some day as well. If OpenWeatherMap fully shuts down their 2.5 API, as the
onecall
API requires users to follow this process (scroll to bottom of page, reply by Uwe Jacobs), which requires a credit card and a billing subscription even though you're signing up for the "free" plan. If this tutorial eventually has to go down that path (well, an alternative should be found in that case), then users should be instructed to set their billing limit to 1000 calls so that their credit card won't get charged for excess calls.For now, swapping out
onecall
forweather
in the URL should work, but you may want to try this on an old OpenWeatherMap account (over a year old) and a newly-created account just in case! The result of the API call is the following, so if the tutorial uses other keys not present here, the actual tutorial contents may need modification as well: