summaryrefslogtreecommitdiff
path: root/aplus.go
diff options
context:
space:
mode:
authorvin <git@vineetk.net>2023-11-16 13:44:11 -0500
committervin <git@vineetk.net>2023-11-20 10:08:58 -0500
commit23226c46a16bd1037016c1578b608eb6d23f7546 (patch)
tree04cad20e31b2d76b5e76bebed151503c89c43f03 /aplus.go
parentb966951c47e2ba886d7a99541072c586b64bb17a (diff)
use the Canvas API to get A+ tool ID and URL
Was previously hardcoded.
Diffstat (limited to 'aplus.go')
-rw-r--r--aplus.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/aplus.go b/aplus.go
index a8d4daf..51a5a10 100644
--- a/aplus.go
+++ b/aplus.go
@@ -7,6 +7,7 @@ import (
7 "io" 7 "io"
8 "net/http" 8 "net/http"
9 "net/url" 9 "net/url"
10 "os"
10 "strings" 11 "strings"
11) 12)
12 13
@@ -60,6 +61,12 @@ func submit_code(course_code int, attendance_code string) {
60} 61}
61 62
62func launch_aplus(course_code int) string { 63func launch_aplus(course_code int) string {
64 err := init_aplus_toolid(course_code)
65 if err != nil {
66 fmt.Println("Failed to get A+ base URL and tool ID")
67 os.Exit(1)
68 }
69
63 aplus_link := fmt.Sprintf("%s/courses/%d/external_tools/sessionless_launch?id=%d&access_token=%s", 70 aplus_link := fmt.Sprintf("%s/courses/%d/external_tools/sessionless_launch?id=%d&access_token=%s",
64 base_link, course_code, external_tools_code, token) 71 base_link, course_code, external_tools_code, token)
65 aplus := get_aplus(token, aplus_link, client) 72 aplus := get_aplus(token, aplus_link, client)