Author Topic: WU-History now works with WU/TMC API...  (Read 13490 times)

0 Members and 1 Guest are viewing this topic.

Offline dasman

  • Forecaster
  • *****
  • Posts: 491
    • Wx Peotone
Re: WU-History now works with WU/TMC API...
« Reply #50 on: May 29, 2019, 07:10:22 PM »
No luck here! Still no data.
Dave Sommerfed
Peotone Illinois USA
CW7762, KILPEOT1
NWS COOP, CoCoRaHS, Spotter Network

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9297
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WU-History now works with WU/TMC API...
« Reply #51 on: May 29, 2019, 08:01:22 PM »
It appears your WCAPIkey is incorrect .. trying an access to api.weather.com gives
Quote
Access Denied
You don't have permission to access "http://api.weather.com/v2/pws/history/all?" on this server.

Reference #18.90f302cc.1559174405.819fc0e
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline dasman

  • Forecaster
  • *****
  • Posts: 491
    • Wx Peotone
Re: WU-History now works with WU/TMC API...
« Reply #52 on: May 29, 2019, 08:09:28 PM »
So should i get a new key? I just got this key a few days ago. Darn the luck.
Dave Sommerfed
Peotone Illinois USA
CW7762, KILPEOT1
NWS COOP, CoCoRaHS, Spotter Network

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9297
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WU-History now works with WU/TMC API...
« Reply #53 on: May 29, 2019, 08:51:00 PM »
No, just send your WUID and WCAPIkey to Victoria.gardner@ibm.com for help.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2578
    • SouthEast Lincoln, NE Weather
Re: WU-History now works with WU/TMC API...
« Reply #54 on: May 29, 2019, 10:06:34 PM »
I finally followed all of the instructions on GitHub and now have access to all of my WU data back to 2008.  (It may take a few seconds for the graphs to be created.)

The key was preloading the cache by running this URL for each year back to 2008, where it was last run:
view-source:https://your.url/WXDailyHistory.php?&year=2008&graphspan=year&debug=y

Very impressive, Ken and Jim! =D> \:D/ =D>
« Last Edit: May 30, 2019, 08:03:38 AM by gwwilk »
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline Stegrie

  • Senior Member
  • **
  • Posts: 97
    • Wetterstation Johanngeorgenstadt
Re: WU-History now works with WU/TMC API...
« Reply #55 on: May 30, 2019, 03:31:07 AM »
The same as yesterday for many hours works it, now the same Issue:
Sorry... the WU data for this date is not currently available. Please try again later.


Offline dasman

  • Forecaster
  • *****
  • Posts: 491
    • Wx Peotone
Re: WU-History now works with WU/TMC API...
« Reply #56 on: May 30, 2019, 07:50:08 AM »
OK. I ran the URL (https://my.url/WXDailyHistory.php?&year=2008&graphspan=year&debug=y) for every year back to 2008. Still no go. I have emailed Victoria so we will see what happens.
Dave Sommerfed
Peotone Illinois USA
CW7762, KILPEOT1
NWS COOP, CoCoRaHS, Spotter Network

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2578
    • SouthEast Lincoln, NE Weather
Re: WU-History now works with WU/TMC API...
« Reply #57 on: May 30, 2019, 08:02:06 AM »
OK. I ran the URL (https://my.url/WXDailyHistory.php?&year=2008&graphspan=year&debug=y) for every year back to 2008. Still no go. I have emailed Victoria so we will see what happens.
Uh-oh.  If that's the command you issued and you used your site's URL instead of 'my.url', without the prepended 'view-source:' you got no feedback as to whether or not the command was actually working.

In this case it might be worth another try.
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline dasman

  • Forecaster
  • *****
  • Posts: 491
    • Wx Peotone
Re: WU-History now works with WU/TMC API...
« Reply #58 on: May 30, 2019, 09:38:01 AM »
I inserted my "actual" url. I checked the cache folder and the data is there. I recieved this response from WU (Victoria)

Quote
  You have exceeded the call limit -- 1500 calls per day -- every day for the past week.  If you want to be able to use the key all day, you need to keep the number of calls you make to fewer than 1500 per day and 30 calls per min.

--Victoria
 
That seems to be alot of calls for 1 day. Could someone be sitting on the page and its auto refreshing? Where in the template is the setting for auto refresh? Maybe mine is on?

EDIT..  i removed refreshing site wide to eliminate that possibility.  I am waiting on reply from Victoria on when/if my key will work again.
« Last Edit: May 30, 2019, 10:55:29 AM by dasman »
Dave Sommerfed
Peotone Illinois USA
CW7762, KILPEOT1
NWS COOP, CoCoRaHS, Spotter Network

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9297
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WU-History now works with WU/TMC API...
« Reply #59 on: May 30, 2019, 11:01:48 AM »
Oooh.. that’s new info on allowed api calls per day.  I’ll need to do additional caching in WXDailyHistory.php to limit the refresh period to once per 5 minutes for day, week and this month queries. The year query is already cached, but I’ll recheck it too.

Likely won’t happen until Sunday when we’re back from vacation.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline dasman

  • Forecaster
  • *****
  • Posts: 491
    • Wx Peotone
Re: WU-History now works with WU/TMC API...
« Reply #60 on: May 30, 2019, 12:16:30 PM »
Here is the reply i just got from Victoria. Something does not seem right with these numbers. My attempts this morning are 25 or less.not sure how many the script actually makes but if it makes the additional 1,400 calls then i wouldnt be the only one in this boat.

Quote
   Well, so far today you've already exceeded the calls for the day this way:

/v2/pws/history/daily 593
/v2/pws/history/all 779
/v2/pws/observations/hourly/7day 358

You're probably off until at least midnight local time.  

 
Dave Sommerfed
Peotone Illinois USA
CW7762, KILPEOT1
NWS COOP, CoCoRaHS, Spotter Network

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9297
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WU-History now works with WU/TMC API...
« Reply #61 on: May 30, 2019, 01:46:15 PM »
Ok, I had time to work up cache for day/week/month files that should keep them 'current', and not overwork the API calls.

try the V1.10-Beta attached.

It now has cache files for day (updated every 150 seconds), and week/month updated every half hour.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline dasman

  • Forecaster
  • *****
  • Posts: 491
    • Wx Peotone
Re: WU-History now works with WU/TMC API...
« Reply #62 on: May 30, 2019, 01:59:05 PM »
Ken, I have loaded the beta script, thanks. I will have to wait until the API key unlocks at midnight tonight or tomorrow night to see how it works.
Dave Sommerfed
Peotone Illinois USA
CW7762, KILPEOT1
NWS COOP, CoCoRaHS, Spotter Network

Offline mldenison

  • Contributor
  • ***
  • Posts: 111
    • York, PA Weather
Re: WU-History now works with WU/TMC API...
« Reply #63 on: May 30, 2019, 02:12:59 PM »
I think WU is having issues.  Mine also show no data - it did yesterday.  Also, I've gotten a dozen or so emails from WU saying my WX station is offline.  When I check, it's back.  WD is chugging right along.
Windows 7 x64
Weather PC: Intel NUC
Davis Vantage Pro 2
Weather Underground: KPAYORK30
York, PA Weather (Saratoga)
York, PA Weather (Leuven)
York, PA PWS Station

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9297
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WU-History now works with WU/TMC API...
« Reply #64 on: May 30, 2019, 05:25:56 PM »
It’s probably the 1500 api access per day limit if it stopped working after previously working.  Try the V1.10 beta from a prior post.  After midnight, you’ll likely start working again.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2578
    • SouthEast Lincoln, NE Weather
Re: WU-History now works with WU/TMC API...
« Reply #65 on: May 30, 2019, 05:43:34 PM »
Ok, I had time to work up cache for day/week/month files that should keep them 'current', and not overwork the API calls.

try the V1.10-Beta attached.

It now has cache files for day (updated every 150 seconds), and week/month updated every half hour.
V1.10-Beta up and running here, Ken.  Works OK, but I didn't see any cache file generated until I ran:
Code: [Select]
WU-History/WXDailyHistory.php?debug=true&force=truewhere I could confirm that the cache file was indeed generated.  Unfortunately my installation is something of a mess.  I manually created the 'WU-History/cache' directory where the 'wuday-...' cache file now resides, while the rest of my cached files are in my './cache' directory.  It's working, so I'm happy.

As an aside, for us dinosaurs still using XHTML 1.0, there were a number of '<br>' tags in 'WXDailyHistory.php' that needed to be converted to '<br/>' in order to validate.  Not a big deal--just thought you should know.  I'm not sure why self-closing tags were created except to harass those of us who are still using older html standards.
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9297
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WU-History now works with WU/TMC API...
« Reply #66 on: May 30, 2019, 05:58:38 PM »
That's a bit strange.. the day cache wuday-<WUID>-<WUunits>.json should be created if missing into the $cacheFileDir directory.  A ?force=1 can force the creation, but shouldn't be necessary for the first time.
same for the week cache wuweek-<WUID>-<WUunits>.json.

Regarding the <br> v.s. <br/>, I chose the former since it matched what the WU version of WXDailyHistory.asp had created, and I didn't want to screw up any scripts that were using preg_match with <br> to sort the rows of the CSV for processing.  Also, the output of the WXDailyHistory.php script is normally only accessed by WU-History-inc.php (or other scripts) for processing the raw data, not for direct presentation to a valid HTML page.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2578
    • SouthEast Lincoln, NE Weather
Re: WU-History now works with WU/TMC API...
« Reply #67 on: May 30, 2019, 06:20:30 PM »
I think I know why the wuday cache file went where it did: that's the cache specified in the WUDailyHistory.php script, not my configured cache directory in the calling script.

I think my global find and replace in this script alone fixed any potential preg_match problems because it’s working fine, and https://www.gwwilkins.org/wxwuhistory.php now validates whereas it didn’t before.

Not really a big deal. Thanks, Ken, for all you do for us.
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9297
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WU-History now works with WU/TMC API...
« Reply #68 on: May 30, 2019, 08:41:24 PM »
I've pushed V1.10 of WXDailyHistory.php with caching improvements to the GitHub distribution (and minor update to the README.md file)  https://github.com/ktrue/WU-History

Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline dasman

  • Forecaster
  • *****
  • Posts: 491
    • Wx Peotone
Re: WU-History now works with WU/TMC API...
« Reply #69 on: May 31, 2019, 07:58:08 AM »
Well, I still have no access with the API. Either WU did not allow me back in at Midnight, or somehow too many calls already today. I checked the page at 5am and got the
Quote
Sorry... the WU data for this date is not currently available. Please try again later.
text. Since I changed to V1.10 yesterday that should not be the case. Not sure what else is going on. I have another email in to Victoria. hopefully she will respond and have the answer.

EDIT: Victoria got back to me...
Quote
   Dave, once the key is throttled, it's 24 hours before it's released again.  Try again later today.
 

Well its now over 24hrs, and still nothing. Im ready to give up. Not worth it.

EDIT: the data came back on last night arround 10pm, but this morning at 6am its gone and Im back to the
Quote
Sorry... the WU data for this date is not currently available. Please try again later.
. ](*,) ](*,) ](*,)
« Last Edit: June 01, 2019, 08:38:29 AM by dasman »
Dave Sommerfed
Peotone Illinois USA
CW7762, KILPEOT1
NWS COOP, CoCoRaHS, Spotter Network

Offline Stegrie

  • Senior Member
  • **
  • Posts: 97
    • Wetterstation Johanngeorgenstadt
Re: WU-History now works with WU/TMC API...
« Reply #70 on: June 01, 2019, 11:04:49 AM »
This site is out of reach for more than 24 hours already,will not work over and over again, that's really less beautiful  :sad:
https://www.wetterstation-johanngeorgenstadt.de/wxwuhistory.php

Stefan

Offline baedkesj

  • Member
  • *
  • Posts: 11
    • Harrisonburg, VA Weather
Re: WU-History now works with WU/TMC API...
« Reply #71 on: June 01, 2019, 04:54:13 PM »
Using version 1.10. 

For the last 2 days my wxwuhistory.php site works starting at about midnight, but by 6am I get the message "Sorry... the WU data for this date is not currently available. Please try again later." for the rest of the day.

Offline chappelledpc

  • Senior Contributor
  • ****
  • Posts: 185
    • Stonybrook South
Re: WU-History now works with WU/TMC API...
« Reply #72 on: June 02, 2019, 05:17:18 PM »
Anyone having trouble with downloading data using their API key? 
Code: [Select]
PHP Warning:  file_get_contents(https://api.weather.com/v2/pws/observations/current?stationId=KNEOMAHA130&format=json&units=e&apiKey=MY_KEY_IS_DELETED_FOR_THIS_EXAMPLE):
failed to open stream: HTTP request failed! HTTP/1.0 401 Unauthorized

Or using using the WU-History script I get : Sorry... the WU data for this date is not currently available. Please try again later.

I have checked to make sure my API key is correct in the scripts.

Something I'm not seeing or missing?

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9297
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WU-History now works with WU/TMC API...
« Reply #73 on: June 02, 2019, 06:56:47 PM »
The 401 Unauthorized response seems to happen when either
1) a valid key has exceeded 1500 API calls/day, or >30 calls per minute or
2) it's not a valid key

Unfortunately, there's no way to tell the difference based solely on the 401 response.

There are several people who are still experiencing the (1) above, even after installing the V1.10 WXDailyHistory.php script -- In discussions with Victoria, she can use the management interface to get the counts (mere mortals can't), but apparently, they don't have the ability to get API calls using a key by IP addresses doing the calls, so there's not a mechanism to tell if someone has poached your key and thereby running up your counts.

The V1.10 of the script carefully limits API calls to once per 2.5 minutes for daily stats, and once per 30 minutes for week/month/year calls, so I don't know where else the calls can be coming from.  Send a note to victoria.gardner@ibm.com with your API key, WUID and ask for diagnosis.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline dasman

  • Forecaster
  • *****
  • Posts: 491
    • Wx Peotone
Re: WU-History now works with WU/TMC API...
« Reply #74 on: June 02, 2019, 10:09:14 PM »
Ken, i have attatched a screen shot of my data when it shows up. I get it for a couple hours each evening and then its gone. Im still working with Victoria to figure out the issue with the API. My question though is the data shown in the screen print I attatched. It shows 22F and other cold temps. As you were just in Illinois you can agree the temperature is a bit warmer then that. Any ideas? [ You are not allowed to view attachments ]
Dave Sommerfed
Peotone Illinois USA
CW7762, KILPEOT1
NWS COOP, CoCoRaHS, Spotter Network