diff options
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 17 |
1 files changed, 7 insertions, 10 deletions
| @@ -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 | ||
| 9 | var base_link string | ||
| 10 | var token string | ||
| 11 | |||
| 10 | func main() { | 12 | func 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) |
