summaryrefslogtreecommitdiff
path: root/aplus.go
diff options
context:
space:
mode:
authorJuan Roig <jaroig@outlook.com>2023-11-13 02:08:03 -0500
committerJuan Roig <jaroig@outlook.com>2023-11-13 02:08:03 -0500
commite46ca43d4cd6e44972123856bbe047eb0517768e (patch)
treea3542a6c165525fd1665aebf12a8ef73c0f6ae16 /aplus.go
parent78fd5e4e1f084b1f031c80c964f795e225f0d25a (diff)
Move aplus requests to new launch_aplus function
Diffstat (limited to 'aplus.go')
-rw-r--r--aplus.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/aplus.go b/aplus.go
index ae5e054..3f3640b 100644
--- a/aplus.go
+++ b/aplus.go
@@ -75,3 +75,31 @@ func extract_attribute(input string, attribute string) string {
75 75
76 return input[start : start+end] 76 return input[start : start+end]
77} 77}
78
79func launch_aplus(course_code int) {
80 aplus_link := fmt.Sprintf("%s/courses/%d/external_tools/sessionless_launch?id=913&access_token=%s", base_link, course_code, token) // 7329 always works
81 aplus := get_aplus(token, aplus_link, client)
82
83 resp, err := client.Get(aplus)
84
85 if err != nil {
86 fmt.Println("Error while performing GET request to aplus auth link.")
87 }
88
89 defer resp.Body.Close()
90 body, _ := io.ReadAll(resp.Body)
91
92 form_str := get_form_from_request_body(body)
93
94 form_values := parse_form(form_str)
95
96 resp, _ = client.PostForm("https://floridapoly.aplusattendance.com/canvas", form_values)
97
98 body, err = io.ReadAll(resp.Body)
99
100 if err != nil {
101 fmt.Println("Error reading body of post form response from aplus attendance.")
102 }
103
104 fmt.Println(string(body))
105}