source: main/branches/origin-master/showforecast.go@ 6bbceb9

Last change on this file since 6bbceb9 was 6bbceb9, checked in by www <www@…>, 8 weeks ago

Mirrored from yuuka.git

git-svn-id: https://svn.chaotic.ninja/svn/yuuka-yakumo.izuru@1 0f3ee07c-c614-0a4d-b2a1-86c95f6ad348

  • Property mode set to 100644
File size: 509 bytes
Line 
1package main
2
3import (
4 "fmt"
5 "io"
6 "net/http"
7)
8
9// Prints the current forecast for a region in standard output
10// Required arguments: region
11// Optional arguments: format
12func ShowForecast(region string, format string, lang string) {
13 query := "https://wttr.in/" + region + "?" + format + "&lang" + lang
14 resp, err := http.Get(query)
15 sanityCheck(err)
16 defer resp.Body.Close()
17 body, err := io.ReadAll(resp.Body)
18 sanityCheck(err)
19 fmt.Printf("%s", body)
20}
Note: See TracBrowser for help on using the repository browser.