A
Austin Althouse
Guest
Hello,
I have a program that runs the following code to obtain weather forecasts from the National Weather Service:
Dim WB As New System.Net.WebClient
Try
WB.Headers.Add("User-Agent", EMAIL AND WEBSITE INFO")
Dim ForecastData As String = WB.DownloadString("https://api.weather.gov/zones/forecast/KSZ069/forecast")
Dim weather As WeatherData = JsonConvert.DeserializeObject(Of WeatherData)(ForecastData)
Dim period As Period = New Period
Label15.Text = weather.periods(0).detailedForecast
Label41.Text = weather.periods(0).name
My.Settings.Forecast_Time = weather.periods(0).name
Label17.Text = weather.periods(1).detailedForecast
Label18.Text = weather.periods(1).name
My.Settings.Forecast_Time_2 = weather.periods(1).name
Catch ex As Exception
End Try
Label16.Text = Label15.Text
But for some reason one day, this code randomly stopped working all together. I checked the link, works. I checked with the National Weather Service, no issues on their end. I debugged and the program either totally skips over the code or when I breakpoint (when I can get it to), it shows the word NOTHING in the spot where the JSON feed code would be. I also get current observations and weather alerts from the same service and both fine, no issues.
I even tried this code on another form in my application to see if it would work correctly. It worked and then quit working.
Another issue is when I debug and step into when its at the break point, it comes up with an error saying that it can't find WebClient.CS. Would the issue be related?
Long story short, what is going on and how can I correct it?
Thank You!
Continue reading...
I have a program that runs the following code to obtain weather forecasts from the National Weather Service:
Dim WB As New System.Net.WebClient
Try
WB.Headers.Add("User-Agent", EMAIL AND WEBSITE INFO")
Dim ForecastData As String = WB.DownloadString("https://api.weather.gov/zones/forecast/KSZ069/forecast")
Dim weather As WeatherData = JsonConvert.DeserializeObject(Of WeatherData)(ForecastData)
Dim period As Period = New Period
Label15.Text = weather.periods(0).detailedForecast
Label41.Text = weather.periods(0).name
My.Settings.Forecast_Time = weather.periods(0).name
Label17.Text = weather.periods(1).detailedForecast
Label18.Text = weather.periods(1).name
My.Settings.Forecast_Time_2 = weather.periods(1).name
Catch ex As Exception
End Try
Label16.Text = Label15.Text
But for some reason one day, this code randomly stopped working all together. I checked the link, works. I checked with the National Weather Service, no issues on their end. I debugged and the program either totally skips over the code or when I breakpoint (when I can get it to), it shows the word NOTHING in the spot where the JSON feed code would be. I also get current observations and weather alerts from the same service and both fine, no issues.
I even tried this code on another form in my application to see if it would work correctly. It worked and then quit working.
Another issue is when I debug and step into when its at the break point, it comes up with an error saying that it can't find WebClient.CS. Would the issue be related?
Long story short, what is going on and how can I correct it?
Thank You!
Continue reading...