Teacher¶
-
class
feupy.
Teacher
(p_codigo: int, use_cache: bool = True, base_url: str = 'https://sigarra.up.pt/feup/en/')¶ This class represents a FEUP teacher as seen from their sigarra webpage.
Note
Some attributes may be set to None, depending on whether or not that attribute was able to be parsed. For example: personal_webpage, email, and presentation are not always available in teacher pages.
Parameters: - p_codigo (int) – The id of the teacher
- use_cache (
bool
, optional) – Attempts to use the cache if True, otherwise it will fetch from sigarra - base_url (
str
, optional) – The url of the faculty (in english) (defaults to “https://sigarra.up.pt/feup/en/”)
-
p_codigo
¶ The id of the teacher
Type: int
-
name
¶ The name of the teacher
Type: str
-
acronym
¶ The acronym of the teacher
Type: str
-
status
¶ The status of the teacher
Type: str
-
links
¶ Urls from the teacher page (including
Teacher.personal_webpage
, if present)Type: tuple(str)
-
personal_webpage
¶ Url of the teacher’s personal page
Type: str
-
url
¶ Url of the teacher’s sigarra page
Type: str
-
voip
¶ Type: int
-
email
¶ Type: str
-
rooms
¶ Type: str
-
category
¶ Type: str
-
career
¶ Type: str
-
profession
¶ Type: str
-
department
¶ Type: str
-
presentation
¶ The presentation of this teacher
Type: str
-
base_url
¶ The url of the teacher’s faculty (in english) (defaults to “https://sigarra.up.pt/feup/en/”)
Type: str
Example:
from feupy import Teacher jlopes = Teacher(230756) print(jlopes.name) # João António Correia Lopes print(jlopes.acronym) # JCL print(jlopes.personal_webpage) # http://www.fe.up.pt/~jlopes/
-
classmethod
from_a_tag
(bs4_tag: bs4.element.Tag, use_cache: bool = True, base_url: str = 'https://sigarra.up.pt/feup/en/')¶ Scrapes the teacher webpage from the given
bs4.tag
object and returns aTeacher
object.Parameters: - bs4_tag (
bs4.tag
) – - use_cache (
bool
, optional) – Attempts to use the cache if True, otherwise it will fetch from sigarra - base_url (
str
, optional) – The url of the faculty (in english) (defaults to “https://sigarra.up.pt/feup/en/”)
Returns: A
Teacher
object- bs4_tag (
-
classmethod
from_url
(url: str, use_cache: bool = True, base_url: str = 'https://sigarra.up.pt/feup/en/')¶ Scrapes the teacher webpage from the given url and returns a
Teacher
object.Parameters: - url (str) – The url of the teacher’s sigarra page
- use_cache (
bool
, optional) – Attempts to use the cache if True, otherwise it will fetch from sigarra - base_url (
str
, optional) – The url of the faculty (in english) (defaults to “https://sigarra.up.pt/feup/en/”)
Returns: A
Teacher
objectExample:
from feupy import Teacher url = "https://sigarra.up.pt/feup/en/func_geral.formview?p_codigo=230756" jlopes = Teacher.from_url(url) print(jlopes.name) # João António Correia Lopes
-
picture
() → PIL.Image.Image¶ Returns a picture of the teacher as a
PIL.Image.Image
object.Returns: A PIL.Image.Image
object