Update wunderground url
All checks were successful
Build and Publish / release (push) Successful in 2m36s
All checks were successful
Build and Publish / release (push) Successful in 2m36s
This commit is contained in:
parent
e8fbacfe6d
commit
eaf2cf211d
2
TODO.md
2
TODO.md
@ -4,6 +4,8 @@
|
|||||||
- [ ] Add Grafana dashboard
|
- [ ] Add Grafana dashboard
|
||||||
- [ ] Add proxy to upstream support
|
- [ ] Add proxy to upstream support
|
||||||
- [ ] Add new spans
|
- [ ] Add new spans
|
||||||
|
- [ ] Fix wunderground 401
|
||||||
|
- [ ] Perform proxy calls in goroutines
|
||||||
|
|
||||||
## Done
|
## Done
|
||||||
- [x] Configuration for app
|
- [x] Configuration for app
|
||||||
|
@ -15,7 +15,7 @@ type WUProvider struct{}
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
providerName = "weatherunderground"
|
providerName = "weatherunderground"
|
||||||
wuURL = "http://rtupdate.wunderground.com/weatherstation/updateweatherstation.php"
|
wuURL = "https://rtupdate.wunderground.com/weatherstation/updateweatherstation.php"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (wu *WUProvider) Name() string {
|
func (wu *WUProvider) Name() string {
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/go-resty/resty/v2"
|
"github.com/go-resty/resty/v2"
|
||||||
"go.opentelemetry.io/otel/attribute"
|
"go.opentelemetry.io/otel/attribute"
|
||||||
@ -39,6 +38,9 @@ func (wu *WUProvider) ProxyReq(ctx context.Context, update *weather.WeatherUpdat
|
|||||||
Get(wuURL)
|
Get(wuURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
span.SetStatus(codes.Error, err.Error())
|
span.SetStatus(codes.Error, err.Error())
|
||||||
|
span.SetAttributes(
|
||||||
|
attribute.String("query", resp.Request.QueryParam.Encode()),
|
||||||
|
)
|
||||||
span.RecordError(err)
|
span.RecordError(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,11 +54,11 @@ func (wu *WUProvider) ProxyReq(ctx context.Context, update *weather.WeatherUpdat
|
|||||||
|
|
||||||
func updateToWuParams(u *weather.WeatherUpdate) *url.Values {
|
func updateToWuParams(u *weather.WeatherUpdate) *url.Values {
|
||||||
params := &url.Values{}
|
params := &url.Values{}
|
||||||
params.Set("dateutc", time.Now().Format(time.DateTime))
|
|
||||||
weather.SetURLVal(params, "ID", &u.StationConfig.WundergroundID)
|
weather.SetURLVal(params, "ID", &u.StationConfig.WundergroundID)
|
||||||
weather.SetURLVal(params, "PASSWORD", &u.StationConfig.WundergroundPassword)
|
weather.SetURLVal(params, "PASSWORD", &u.StationConfig.WundergroundPassword)
|
||||||
|
params.Set("action", "updateraw")
|
||||||
|
params.Set("dateutc", "now")
|
||||||
weather.SetURLVal(params, "UV", u.UV)
|
weather.SetURLVal(params, "UV", u.UV)
|
||||||
weather.SetURLVal(params, "action", ptr.To("updateraw"))
|
|
||||||
weather.SetURLVal(params, "baromin", u.BaromRelativeIn)
|
weather.SetURLVal(params, "baromin", u.BaromRelativeIn)
|
||||||
weather.SetURLVal(params, "dailyrainin", u.DailyRainIn)
|
weather.SetURLVal(params, "dailyrainin", u.DailyRainIn)
|
||||||
weather.SetURLVal(params, "dewptf", u.DewPointF)
|
weather.SetURLVal(params, "dewptf", u.DewPointF)
|
||||||
|
Loading…
Reference in New Issue
Block a user