Student

class feupy.Student(username: int, use_cache: bool = True)

This class represents a FEUP student as seen from their sigarra webpage.

Parameters:
  • username (int) – The username of the student, e.g. 201806185
  • use_cache (bool, optional) – Attempts to use the cache if True, otherwise it will fetch from sigarra
name

The name of the student

Type:str

Urls from the student page (including Student.personal_webpage, if present)

Type:tuple(str)
personal_webpage

Url of the student’s personal page, if present. Otherwise it is set to None

Type:str
username

The student’s “pv_num_unico”

Type:int
url

Url of the student’s sigarra page

Type:str
courses

The courses this student is enrolled in

Type:tuple(dict)
Each dictionary from the courses tuple has 3 keys
  • “course” (a Course object or a string (if a link to a course wasn’t available))
  • “first academic year” (int): if your first year is 2019/2020, then “first academic year” will be 2019
  • “institution” (string)

Example:

from feupy import Student

daniel = Student(201806185)

print(daniel.name)
# Daniel Filipe Amaro Monteiro

print(daniel.username)
# 201806185

print(daniel.courses)
# ({'course': Course(742, 2019), 'institution': 'Faculty of Engineering', 'first academic year': 2018},)
classmethod from_a_tag(bs4_tag: bs4.element.Tag, use_cache: bool = True)

Scrapes the student webpage from the given bs4.tag object and returns a Student object.

Parameters:
  • bs4_tag (bs4.tag) –
  • use_cache (bool, optional) – Attempts to use the cache if True, otherwise it will fetch from sigarra
Returns:

A Student object

classmethod from_url(url: str, use_cache: bool = True)

Scrapes the student webpage from the given url and returns a Student object.

Parameters:
  • url (str) – The url of the student’s sigarra page
  • use_cache (bool, optional) – Attempts to use the cache if True, otherwise it will fetch from sigarra
Returns:

A Student object

Example:

from feupy import Student

url = "https://sigarra.up.pt/feup/pt/fest_geral.cursos_list?pv_num_unico=201806185"
daniel = Student.from_url(url)

print(daniel.name)
# Daniel Filipe Amaro Monteiro
full_info(credentials: feupy._Credentials.Credentials) → dict

Returns a dictionary with the information that one can get when it is logged in.

The dictionary has 7 keys:
  • “courses” (list(dict))
  • “email” (str)
  • “links” (tuple(str))
  • “name” (str)
  • “personal_webpage” (str)
  • “url” (str)
  • “username” (int)
Parameters:credentials (Credentials) – A Credentials object
Returns:A dictionary

Example:

from feupy import Student, Credentials
from pprint import pprint

daniel = Student(201806185)

creds = Credentials()

pprint(daniel.full_info(creds))

# You will get something like this:
{'courses': [ # A list of dictionaries representing the courses' information
             {'course': Course(742, 2019), # A Course object. If a link to an object isn't available, it's just a string
              'current year': 2,   # Could be None if a number isn't present (or couldn't be parsed)
              'first academic year': 2018,
              'institution': 'Faculty of Engineering', # Best faculty
              'status': 'A Frequentar'}],
'email': 'up201806185@fe.up.pt',
'links': (),                      # personal_webpage is included in links
'name': 'Daniel Filipe Amaro Monteiro', # people tend to have a name
'personal_webpage': None,
'url': 'https://sigarra.up.pt/feup/en/fest_geral.cursos_list?pv_num_unico=201806185',
'username': 201806185}