diff options
| -rw-r--r-- | aplus.go | 4 | ||||
| -rw-r--r-- | canvas.go | 10 |
2 files changed, 12 insertions, 2 deletions
| @@ -8,8 +8,8 @@ import ( | |||
| 8 | "net/http" | 8 | "net/http" |
| 9 | "net/url" | 9 | "net/url" |
| 10 | "regexp" | 10 | "regexp" |
| 11 | "strings" | ||
| 12 | "strconv" | 11 | "strconv" |
| 12 | "strings" | ||
| 13 | "time" | 13 | "time" |
| 14 | ) | 14 | ) |
| 15 | 15 | ||
| @@ -238,7 +238,7 @@ func timetable(course_code int) { | |||
| 238 | hour, _ := strconv.Atoi(jsdate[3]) | 238 | hour, _ := strconv.Atoi(jsdate[3]) |
| 239 | min, _ := strconv.Atoi(jsdate[4]) | 239 | min, _ := strconv.Atoi(jsdate[4]) |
| 240 | sec, _ := strconv.Atoi(jsdate[5]) | 240 | sec, _ := strconv.Atoi(jsdate[5]) |
| 241 | date := time.Date(year, time.Month(month + 1), day, hour, min, sec, 0, time.UTC).Local() | 241 | date := time.Date(year, time.Month(month+1), day, hour, min, sec, 0, time.UTC).Local() |
| 242 | 242 | ||
| 243 | fmt.Println(date.Format("Mon Jan 02 15:04:05 MST 2006") + ": " + strings.Replace(statuses[i], "title=\"\">", "", 1)) | 243 | fmt.Println(date.Format("Mon Jan 02 15:04:05 MST 2006") + ": " + strings.Replace(statuses[i], "title=\"\">", "", 1)) |
| 244 | } | 244 | } |
| @@ -15,8 +15,18 @@ import ( | |||
| 15 | 15 | ||
| 16 | func initialize() { | 16 | func initialize() { |
| 17 | instance_url := os.Getenv("CANVAS_INSTANCE") | 17 | instance_url := os.Getenv("CANVAS_INSTANCE") |
| 18 | if len(instance_url) == 0 { | ||
| 19 | fmt.Println("The CANVAS_INSTANCE environment variable seems to be empty. Exiting.") | ||
| 20 | os.Exit(1) | ||
| 21 | } | ||
| 22 | |||
| 18 | base_link = instance_url + "/api/v1" | 23 | base_link = instance_url + "/api/v1" |
| 19 | token = os.Getenv("CANVAS_API_KEY") | 24 | token = os.Getenv("CANVAS_API_KEY") |
| 25 | if len(token) == 0 { | ||
| 26 | fmt.Println("The CANVAS_API_KEY environment variable seems to be empty. Exiting.") | ||
| 27 | os.Exit(1) | ||
| 28 | } | ||
| 29 | |||
| 20 | jar, _ := cookiejar.New(&cookiejar.Options{ | 30 | jar, _ := cookiejar.New(&cookiejar.Options{ |
| 21 | PublicSuffixList: publicsuffix.List, | 31 | PublicSuffixList: publicsuffix.List, |
| 22 | }) | 32 | }) |
