summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJuan Roig <jaroig@outlook.com>2023-11-07 00:21:48 -0500
committerJuan Roig <jaroig@outlook.com>2023-11-07 00:21:48 -0500
commit89c2e2b38ee57f40217db83fb34e014102b0fb49 (patch)
tree201a22da1d9356aba318a13cd669827473504d25 /main.go
parent4af67b036396ca952b85b93b4d4bc371cd7bfcd9 (diff)
reorganize functions to aplus-related and canvas-related.
Diffstat (limited to 'main.go')
-rw-r--r--main.go17
1 files changed, 7 insertions, 10 deletions
diff --git a/main.go b/main.go
index 27dc3fd..0480117 100644
--- a/main.go
+++ b/main.go
@@ -4,9 +4,11 @@ import (
4 "fmt" 4 "fmt"
5 "io" 5 "io"
6 "net/http" 6 "net/http"
7 "os"
8) 7)
9 8
9var base_link string
10var token string
11
10func main() { 12func main() {
11 client := http.Client{ 13 client := http.Client{
12 CheckRedirect: func(req *http.Request, via []*http.Request) error { 14 CheckRedirect: func(req *http.Request, via []*http.Request) error {
@@ -15,8 +17,7 @@ func main() {
15 }, 17 },
16 } 18 }
17 19
18 base_link := "https://floridapolytechnic.instructure.com/api/v1" 20 initialize()
19 token := os.Getenv("CANVAS_API_KEY")
20 21
21 // select_course() 22 // select_course()
22 23
@@ -30,11 +31,7 @@ func main() {
30 } 31 }
31 32
32 defer resp.Body.Close() 33 defer resp.Body.Close()
33 body, err := io.ReadAll(resp.Body) 34 body, _ := io.ReadAll(resp.Body)
34
35 if err != nil {
36 fmt.Println("Error reading body of initial aplus html response.")
37 }
38 35
39 form_str := get_form_from_request_body(body) 36 form_str := get_form_from_request_body(body)
40 fmt.Println(form_str) 37 fmt.Println(form_str)
@@ -62,8 +59,8 @@ func main() {
62 fmt.Println(req) 59 fmt.Println(req)
63 60
64 // we need to submit the above post request correctly in order to submit this request. 61 // we need to submit the above post request correctly in order to submit this request.
65 //resp, err = client.Get("https://floridapoly.aplusattendance.com/canvas/student/?canvasCourse=7329&doStudentAuth=true") 62 //resp, _ = client.Get("https://floridapoly.aplusattendance.com/canvas/student/?canvasCourse=7329&doStudentAuth=true")
66 //body, err = io.ReadAll(req.Body) 63 //body, _ = io.ReadAll(resp.Body)
67 64
68 //fmt.Println(string(body)) 65 //fmt.Println(string(body))
69 //fmt.Println(req) 66 //fmt.Println(req)