Bootstrap project
This commit is contained in:
parent
7eaf25d9b2
commit
83e387a89b
|
@ -0,0 +1,26 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func main() {
|
||||
resp, err := http.Get("https://www.aemet.es/xml/municipios/localidad_46250.xml")
|
||||
if err != nil {
|
||||
log.Fatalf("Error occurred pulling data: %v\n", err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
log.Fatalf("Error occurred accessing website: %v\n", err)
|
||||
}
|
||||
|
||||
data, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
log.Fatalf("Error occurred reading data: %v\n", err)
|
||||
}
|
||||
|
||||
fmt.Print(string(data))
|
||||
}
|
Loading…
Reference in New Issue