Documentation
¶
Index ¶
Constants ¶
const ( EventDateStart = "DTSTART" EventDescription = "DESCRIPTION" EventSummary = "SUMMARY" LayoutISO8601CompactZ = "20060102T150405Z0700" LayoutISO8601CompactNoTZ = "20060102T150405" LayoutISO8601Short = "20060102" )
const ( Timeout = 120 * time.Second // site can get really slow sometimes ChromeUA = "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Mobile Safari/537.36" // ChromeUA is a user agent string mimicking Chrome on Android. )
const ( BaseURL = "https://ocjene.skole.hr" LoginURL = "https://ocjene.skole.hr/login" ClassURL = "https://ocjene.skole.hr/class" ClassActionURL = "https://ocjene.skole.hr/class_action/%v/course" GradeAllURL = "https://ocjene.skole.hr/grade/all" CalendarURL = "https://ocjene.skole.hr/exam/ical" CourseURL = "https://ocjene.skole.hr/course" MaxBodySize = 32 * 1024 * 1024 // 32 MiB upper bound for any single response // AcceptLanguageHR nudges the portal to return Croatian-localised pages and // error messages, which matters for the alert-text matcher in doSAMLRequest // and for human-readable subject/course names downstream. AcceptLanguageHR = "hr,hr-HR;q=0.9,en;q=0.1" )
Variables ¶
var ( ErrUnexpectedStatus = errors.New("unexpected status code") ErrCSRFToken = errors.New("could not find CSRF token") ErrNilBody = errors.New("client body is nil") ErrInvalidLogin = errors.New("unable to login") ErrBodyTooLarge = errors.New("response body exceeds size limit") )
var (
ErrParseTimestamp = errors.New("failed to parse timestamp")
)
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client structure holds all HTTP Client related fields.
func NewClientWithContext ¶
NewClientWithContext creates new *Client, initializing HTTP Cookie Jar, context and username with password.
func (*Client) CloseConnections ¶ added in v0.9.0
func (c *Client) CloseConnections()
CloseConnections closes all connections on its transport.
func (*Client) GetClassEvents ¶ added in v0.9.0
GetClassEvents attempts to fetch all subjects and their grades, as well as all calendar events for exams in ICS format, returning raw grades listing body bytes, parsed exam events and optional error.
func (*Client) GetClasses ¶ added in v0.9.0
GetClasses attempts to fetch all courses where a student has been previously enlisted or still is (multiple active classes possible).
func (*Client) GetCourse ¶ added in v0.21.0
GetCourse fetches the course with the given destination URL and returns its raw body, or an error.
func (*Client) GetCourses ¶ added in v0.21.0
GetCourses attempts to fetch all active courses.