diff options
Diffstat (limited to 'aplus.go')
| -rw-r--r-- | aplus.go | 28 |
1 files changed, 28 insertions, 0 deletions
| @@ -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 | |||
| 79 | func 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 | } | ||
