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 forces Croatian responses; the login alert matcher and subject names depend on it. 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") ErrInvalidClassID = errors.New("invalid class ID — refusing to construct URL") ErrInvalidHost = errors.New("portal href resolves to non-portal host — refusing to fetch") )
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 ¶
func (c *Client) CloseConnections()
CloseConnections closes all connections on its transport.
func (*Client) GetClassEvents ¶
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 ¶
GetClasses attempts to fetch all courses where a student has been previously enlisted or still is (multiple active classes possible).
func (*Client) GetCourse ¶
GetCourse fetches the course with the given destination URL and returns its raw body, or an error.
func (*Client) GetCourses ¶
GetCourses attempts to fetch all active courses.