User¶
-
class
feupy.
User
(pv_fest_id: int, credentials: feupy._Credentials.Credentials)¶ This class represents the information that can be extracted from your personal webpage.
Parameters: - pv_fest_id (int) – Your pv_fest_id. See
User.get_pv_fest_ids()
for a way to get this value. If you are enrolled in only one course, thenUser.from_credentials()
may be more convenient for you - credentials (
Credentials
) – ACredentials
object
-
pv_fest_id
¶ A sort of course specific student identification number
Type: int
-
credentials
¶ A
Credentials
object (This is done to avoid having to pass the sameCredentials
object to every function)Type: Credentials
Example:
from feupy import Credentials, User creds = Credentials() me = User(123456, creds)
-
all_timetables
() → dict¶ Parses all the timetables related to this user (see
timetable.parse_timetables
for further info).Returns: A dictionary which maps a tuple with two datetime.date
objects, start and finish (the time span in which this timetable is valid), to a list of dictionaries (seetimetable.parse_timetable
for an example of such a list).
-
classes
()¶ Returns the classes you are in as a list of tuples.
- Each tuple has 2 elements:
- A
CurricularUnit
object - The class name as a string.
- A
Returns: A list of tuples
-
courses_units
() → list¶ Returns your grades as a list of tuples.
- Each tuple has 2 elements:
- A
CurricularUnit
object which represents a curricular unit that - you either have had in a previous year or you are currently enrolled in
- A
- Either an int which represents the grade you got at that curricular unit or None
- if that grade is not available
Returns: A list of tuples Example:
from feupy import Credentials, User from pprint import pprint creds = Credentials() me = User.from_credentials(creds) pprint(me.courses_units()) # You will get something like this: [(CurricularUnit(419981), 10), (CurricularUnit(419982), 11), (CurricularUnit(419983), 12), (CurricularUnit(419984), 13), (CurricularUnit(419985), 14), (CurricularUnit(420521), 15), (CurricularUnit(419986), None), (CurricularUnit(419987), None), (CurricularUnit(419988), None), (CurricularUnit(419989), None), (CurricularUnit(419990), None)]
-
classmethod
from_credentials
(credentials: feupy._Credentials.Credentials)¶ Returns a User object made from the first result from get_pv_fest_ids().
Usually, students are enrolled in only one course, which means that get_pv_fest_ids() tends to be a tuple with a single int.
Parameters: credentials ( Credentials
) – ACredentials
objectReturns: A User
objectExample:
from feupy import Credentials, User creds = Credentials() me = User.from_credentials(creds)
-
static
get_pv_fest_ids
(credentials: feupy._Credentials.Credentials) → tuple¶ Returns a tuple of ints, each representing a pv_fest_id.
Parameters: credentials ( Credentials
) – ACredentials
objectReturns: A tuple of ints
-
timetable
() → list¶ Returns the current user timetable as a list of dictionaries if possible, otherwise returns None. (see
timetable.parse_current_timetable()
for more info)Returns: A list of dicts
- pv_fest_id (int) – Your pv_fest_id. See