From 89c2e2b38ee57f40217db83fb34e014102b0fb49 Mon Sep 17 00:00:00 2001 From: Juan Roig Date: Tue, 7 Nov 2023 00:21:48 -0500 Subject: reorganize functions to aplus-related and canvas-related. --- main.go | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index 27dc3fd..0480117 100644 --- a/main.go +++ b/main.go @@ -4,9 +4,11 @@ import ( "fmt" "io" "net/http" - "os" ) +var base_link string +var token string + func main() { client := http.Client{ CheckRedirect: func(req *http.Request, via []*http.Request) error { @@ -15,8 +17,7 @@ func main() { }, } - base_link := "https://floridapolytechnic.instructure.com/api/v1" - token := os.Getenv("CANVAS_API_KEY") + initialize() // select_course() @@ -30,11 +31,7 @@ func main() { } defer resp.Body.Close() - body, err := io.ReadAll(resp.Body) - - if err != nil { - fmt.Println("Error reading body of initial aplus html response.") - } + body, _ := io.ReadAll(resp.Body) form_str := get_form_from_request_body(body) fmt.Println(form_str) @@ -62,8 +59,8 @@ func main() { fmt.Println(req) // we need to submit the above post request correctly in order to submit this request. - //resp, err = client.Get("https://floridapoly.aplusattendance.com/canvas/student/?canvasCourse=7329&doStudentAuth=true") - //body, err = io.ReadAll(req.Body) + //resp, _ = client.Get("https://floridapoly.aplusattendance.com/canvas/student/?canvasCourse=7329&doStudentAuth=true") + //body, _ = io.ReadAll(resp.Body) //fmt.Println(string(body)) //fmt.Println(req) -- cgit v1.2.3