diff options
Diffstat (limited to 'weather')
-rw-r--r-- | weather/weather.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/weather/weather.go b/weather/weather.go index d60e22c..87b7a83 100644 --- a/weather/weather.go +++ b/weather/weather.go @@ -37,7 +37,17 @@ type weatherdata struct { func CurrentWeather(place string) (Weather, error) { url := "http://www.yr.no/place/" + place + "/forecast_hour_by_hour.xml" - resp, err := http.Get(url) + + client := &http.Client{} + + req, err := http.NewRequest("GET", url, nil) + if err != nil { + return Weather{}, err + } + + req.Header.Add("User-Agent", "github.com/slivasur/startpage/weather") + + resp, err := client.Do(req) if err != nil { return Weather{}, err } |