esprit-py 0.1.0__py3-none-any.whl → 0.2.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of esprit-py might be problematic. Click here for more details.
- esprit/__init__.py +1 -0
- esprit/{absence_scrape.py → absence.py} +28 -0
- esprit/auth.py +34 -0
- esprit/credit.py +27 -0
- esprit/esprit.py +3 -3
- esprit/{grade_scrape.py → grade.py} +27 -0
- esprit/{time_schedule_scrape.py → time_schedule.py} +70 -0
- {esprit_py-0.1.0.dist-info → esprit_py-0.2.1.dist-info}/METADATA +15 -3
- esprit_py-0.2.1.dist-info/RECORD +11 -0
- esprit_py-0.1.0.dist-info/RECORD +0 -11
- {esprit_py-0.1.0.dist-info → esprit_py-0.2.1.dist-info}/WHEEL +0 -0
- {esprit_py-0.1.0.dist-info → esprit_py-0.2.1.dist-info}/top_level.txt +0 -0
esprit/__init__.py
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .esprit import Esprit
|
|
@@ -3,11 +3,39 @@ from bs4 import BeautifulSoup
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
class Absence:
|
|
6
|
+
"""
|
|
7
|
+
A class used to represent an Absence.
|
|
8
|
+
|
|
9
|
+
...
|
|
10
|
+
|
|
11
|
+
Attributes
|
|
12
|
+
----------
|
|
13
|
+
url : str
|
|
14
|
+
a formatted string that represents the URL of the absence page
|
|
15
|
+
session : requests.Session
|
|
16
|
+
a Session object from the requests library
|
|
17
|
+
|
|
18
|
+
Methods
|
|
19
|
+
-------
|
|
20
|
+
get_absences():
|
|
21
|
+
Returns a list of absences for the student.
|
|
22
|
+
"""
|
|
23
|
+
|
|
6
24
|
def __init__(self, session):
|
|
7
25
|
self.url = "https://esprit-tn.com/ESPOnline/Etudiants/absenceetud.aspx"
|
|
8
26
|
self.session = session
|
|
9
27
|
|
|
10
28
|
def get_absences(self):
|
|
29
|
+
"""
|
|
30
|
+
Returns a list of absences for the student.
|
|
31
|
+
|
|
32
|
+
Returns
|
|
33
|
+
-------
|
|
34
|
+
list
|
|
35
|
+
a list of absences, each represented as a list of strings. The first list is the headers.
|
|
36
|
+
Returns None if the page does not contain the expected text.
|
|
37
|
+
"""
|
|
38
|
+
|
|
11
39
|
response = self.session.get(self.url)
|
|
12
40
|
soup = BeautifulSoup(response.text, 'html.parser')
|
|
13
41
|
|
esprit/auth.py
CHANGED
|
@@ -2,11 +2,45 @@ import requests
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
class Auth:
|
|
5
|
+
"""
|
|
6
|
+
A class used to represent an Authentication.
|
|
7
|
+
|
|
8
|
+
...
|
|
9
|
+
|
|
10
|
+
Attributes
|
|
11
|
+
----------
|
|
12
|
+
login_url : str
|
|
13
|
+
a formatted string that represents the login URL
|
|
14
|
+
session : requests.Session
|
|
15
|
+
a Session object from the requests library
|
|
16
|
+
|
|
17
|
+
Methods
|
|
18
|
+
-------
|
|
19
|
+
login(id: str, password: str):
|
|
20
|
+
Logs in to the website using the provided id and password.
|
|
21
|
+
"""
|
|
22
|
+
|
|
5
23
|
def __init__(self, session=None):
|
|
6
24
|
self.login_url = "https://esprit-tn.com/esponline/online/default.aspx"
|
|
7
25
|
self.session = session if session else requests.session()
|
|
8
26
|
|
|
9
27
|
def login(self, id, password):
|
|
28
|
+
"""
|
|
29
|
+
Logs in to the website using the provided id and password.
|
|
30
|
+
|
|
31
|
+
Parameters
|
|
32
|
+
----------
|
|
33
|
+
id : str
|
|
34
|
+
the id to use for login
|
|
35
|
+
password : str
|
|
36
|
+
the password to use for login
|
|
37
|
+
|
|
38
|
+
Returns
|
|
39
|
+
-------
|
|
40
|
+
requests.Session
|
|
41
|
+
the Session object used for the login. This can be used for subsequent requests.
|
|
42
|
+
Returns None if the login failed.
|
|
43
|
+
"""
|
|
10
44
|
id_payload = {
|
|
11
45
|
'__EVENTTARGET': '',
|
|
12
46
|
'__EVENTARGUMENT': '',
|
esprit/credit.py
CHANGED
|
@@ -3,11 +3,38 @@ from bs4 import BeautifulSoup
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
class Credit:
|
|
6
|
+
"""
|
|
7
|
+
A class used to represent a Credit.
|
|
8
|
+
|
|
9
|
+
...
|
|
10
|
+
|
|
11
|
+
Attributes
|
|
12
|
+
----------
|
|
13
|
+
url : str
|
|
14
|
+
a formatted string that represents the URL of the credit page
|
|
15
|
+
session : requests.Session
|
|
16
|
+
a Session object from the requests library
|
|
17
|
+
|
|
18
|
+
Methods
|
|
19
|
+
-------
|
|
20
|
+
get_credits():
|
|
21
|
+
Returns a list of credits for the student.
|
|
22
|
+
"""
|
|
23
|
+
|
|
6
24
|
def __init__(self, session):
|
|
7
25
|
self.url = "https://esprit-tn.com/ESPOnline/Etudiants/Historique_Cr%C3%A9dit.aspx"
|
|
8
26
|
self.session = session
|
|
9
27
|
|
|
10
28
|
def get_credits(self):
|
|
29
|
+
"""
|
|
30
|
+
Returns a list of credits for the student.
|
|
31
|
+
|
|
32
|
+
Returns
|
|
33
|
+
-------
|
|
34
|
+
list
|
|
35
|
+
a list of credits, each represented as a list of strings. The first list is the headers.
|
|
36
|
+
Returns None if the page does not contain the expected text.
|
|
37
|
+
"""
|
|
11
38
|
response = self.session.get(self.url)
|
|
12
39
|
soup = BeautifulSoup(response.text, 'html.parser')
|
|
13
40
|
|
esprit/esprit.py
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import requests
|
|
2
2
|
from auth import Auth
|
|
3
|
-
from
|
|
4
|
-
from
|
|
5
|
-
from
|
|
3
|
+
from grade import Grade
|
|
4
|
+
from absence import Absence
|
|
5
|
+
from time_schedule import TimeSchedule
|
|
6
6
|
from credit import Credit
|
|
7
7
|
|
|
8
8
|
|
|
@@ -3,11 +3,38 @@ from bs4 import BeautifulSoup
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
class Grade:
|
|
6
|
+
"""
|
|
7
|
+
A class used to represent a Grade.
|
|
8
|
+
|
|
9
|
+
...
|
|
10
|
+
|
|
11
|
+
Attributes
|
|
12
|
+
----------
|
|
13
|
+
url : str
|
|
14
|
+
a formatted string that represents the URL of the grade page
|
|
15
|
+
session : requests.Session
|
|
16
|
+
a Session object from the requests library
|
|
17
|
+
|
|
18
|
+
Methods
|
|
19
|
+
-------
|
|
20
|
+
get_grades():
|
|
21
|
+
Returns a list of grades for the student.
|
|
22
|
+
"""
|
|
23
|
+
|
|
6
24
|
def __init__(self, session):
|
|
7
25
|
self.url = "https://esprit-tn.com/ESPOnline/Etudiants/Resultat2021.aspx"
|
|
8
26
|
self.session = session
|
|
9
27
|
|
|
10
28
|
def get_grades(self):
|
|
29
|
+
"""
|
|
30
|
+
Returns a list of grades for the student.
|
|
31
|
+
|
|
32
|
+
Returns
|
|
33
|
+
-------
|
|
34
|
+
list
|
|
35
|
+
a list of grades, each represented as a list of strings. The first list is the headers.
|
|
36
|
+
Returns None if the page does not contain the expected text.
|
|
37
|
+
"""
|
|
11
38
|
response = self.session.get(self.url)
|
|
12
39
|
soup = BeautifulSoup(response.text, 'html.parser')
|
|
13
40
|
|
|
@@ -7,11 +7,44 @@ from PyPDF2 import PdfReader, PdfWriter
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class TimeSchedule:
|
|
10
|
+
"""
|
|
11
|
+
A class used to represent a Time Schedule.
|
|
12
|
+
|
|
13
|
+
...
|
|
14
|
+
|
|
15
|
+
Attributes
|
|
16
|
+
----------
|
|
17
|
+
url : str
|
|
18
|
+
a formatted string that represents the URL of the time schedule page
|
|
19
|
+
session : requests.Session
|
|
20
|
+
a Session object from the requests library
|
|
21
|
+
|
|
22
|
+
Methods
|
|
23
|
+
-------
|
|
24
|
+
get_table_schedules():
|
|
25
|
+
Returns a list of time schedules for the student.
|
|
26
|
+
get_last_week_schedule():
|
|
27
|
+
Returns the most recent weekly schedule.
|
|
28
|
+
download_files(schedule: list):
|
|
29
|
+
Downloads the files associated with a given schedule.
|
|
30
|
+
get_class_week_schedule(file_path: str, class_name: str):
|
|
31
|
+
Extracts the weekly schedule for a specific class from a given file.
|
|
32
|
+
"""
|
|
33
|
+
|
|
10
34
|
def __init__(self, session):
|
|
11
35
|
self.url = "https://esprit-tn.com/ESPOnline/Etudiants/Emplois.aspx"
|
|
12
36
|
self.session = session
|
|
13
37
|
|
|
14
38
|
def get_table_schedules(self):
|
|
39
|
+
"""
|
|
40
|
+
Returns a list of time schedules for the student.
|
|
41
|
+
|
|
42
|
+
Returns
|
|
43
|
+
-------
|
|
44
|
+
list
|
|
45
|
+
a list of time schedules, each represented as a list of strings.
|
|
46
|
+
Returns None if the page does not contain the expected text.
|
|
47
|
+
"""
|
|
15
48
|
response = self.session.get(self.url)
|
|
16
49
|
soup = BeautifulSoup(response.text, 'html.parser')
|
|
17
50
|
|
|
@@ -36,6 +69,15 @@ class TimeSchedule:
|
|
|
36
69
|
return time_schedules
|
|
37
70
|
|
|
38
71
|
def get_last_week_schedule(self):
|
|
72
|
+
"""
|
|
73
|
+
Returns the most recent weekly schedule.
|
|
74
|
+
|
|
75
|
+
Returns
|
|
76
|
+
-------
|
|
77
|
+
list
|
|
78
|
+
the most recent weekly schedule, represented as a list of strings.
|
|
79
|
+
Returns None if no schedules are found.
|
|
80
|
+
"""
|
|
39
81
|
time_schedules = self.get_table_schedules()
|
|
40
82
|
if time_schedules is None:
|
|
41
83
|
return None
|
|
@@ -59,6 +101,19 @@ class TimeSchedule:
|
|
|
59
101
|
return dates_and_schedules[-1][1] if dates_and_schedules else None
|
|
60
102
|
|
|
61
103
|
def download_files(self, schedule):
|
|
104
|
+
"""
|
|
105
|
+
Downloads the files associated with a given schedule.
|
|
106
|
+
|
|
107
|
+
Parameters
|
|
108
|
+
----------
|
|
109
|
+
schedule : list
|
|
110
|
+
the schedule to download files for, represented as a list of strings
|
|
111
|
+
|
|
112
|
+
Returns
|
|
113
|
+
-------
|
|
114
|
+
str
|
|
115
|
+
the path to the downloaded file
|
|
116
|
+
"""
|
|
62
117
|
response = self.session.get(self.url)
|
|
63
118
|
soup = BeautifulSoup(response.text, 'html.parser')
|
|
64
119
|
|
|
@@ -87,6 +142,21 @@ class TimeSchedule:
|
|
|
87
142
|
return file_path
|
|
88
143
|
|
|
89
144
|
def get_class_week_schedule(self, file_path, class_name):
|
|
145
|
+
"""
|
|
146
|
+
Extracts the weekly schedule for a specific class from a given file.
|
|
147
|
+
|
|
148
|
+
Parameters
|
|
149
|
+
----------
|
|
150
|
+
file_path : str
|
|
151
|
+
the path to the file to extract the schedule from
|
|
152
|
+
class_name : str
|
|
153
|
+
the name of the class to extract the schedule for
|
|
154
|
+
|
|
155
|
+
Returns
|
|
156
|
+
-------
|
|
157
|
+
str
|
|
158
|
+
the path to the extracted schedule, or None if the class is not found in the file
|
|
159
|
+
"""
|
|
90
160
|
# Open the existing PDF
|
|
91
161
|
with open(file_path, "rb") as file:
|
|
92
162
|
reader = PdfReader(file)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: esprit-py
|
|
3
|
-
Version: 0.1
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: A Python library for interacting with data from esprit-tn.com
|
|
5
5
|
Author: Lime1 (Aymen Hmani)
|
|
6
6
|
Author-email: <everpadd4@gmail.com>
|
|
@@ -17,7 +17,19 @@ Requires-Dist: beautifulsoup4
|
|
|
17
17
|
Requires-Dist: PyPDF2
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
# esprit-
|
|
21
|
-
|
|
20
|
+
# <img src="https://esprit.tn/favicon.ico" width="28px" /> esprit-py
|
|
21
|
+
|
|
22
|
+
> [!NOTE]
|
|
23
|
+
> Please note that this library is not an official API provided by Esprit and is intended for educational and personal use only.
|
|
24
|
+
|
|
25
|
+
## Features
|
|
26
|
+
|
|
27
|
+
- Get your exact timetable pdf not 300 pages pdf
|
|
28
|
+
- Get your grades
|
|
29
|
+
- Get your absences
|
|
30
|
+
- Get your credits
|
|
31
|
+
|
|
22
32
|
missing stuff:
|
|
23
33
|
- [ ] download any time table from the esprit website , not only the last one
|
|
34
|
+
- [ ] post stuff (reclamation,document stage,teacher evaluation) *dangereous area tbh*
|
|
35
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
esprit/__init__.py,sha256=PnahGRQ5xmA26XMFaj9ImLty9OEmYwnBqLanvGXZwwU,28
|
|
2
|
+
esprit/absence.py,sha256=qOFyK0QmSaWYrz_2RlDFcCom-m6QZLJAzG1dBj3YkbI,1666
|
|
3
|
+
esprit/auth.py,sha256=2N7B5QV9NiDTDvBbiqzHAOsdOSX53XXSGa0mr9SUIQI,4021
|
|
4
|
+
esprit/credit.py,sha256=iKy_lTR_iLAkpRkP92l2gAUi4Dh6JvLidxGhuM9YJ68,1747
|
|
5
|
+
esprit/esprit.py,sha256=CSDo_fgcs8cavGYAnrdONqS-xtIKVbCkuTBpQ_5zg1M,1347
|
|
6
|
+
esprit/grade.py,sha256=EAgYvA-490Jj9TeUCIlSQeW4aVu2gcmfujNxDG-91Fw,1648
|
|
7
|
+
esprit/time_schedule.py,sha256=KcT0XMpY3lJyT9v9pJ3xrPEBqPRZRi4kz0jhrozek2M,6220
|
|
8
|
+
esprit_py-0.2.1.dist-info/METADATA,sha256=jAXzWxnhRmwkPaomAt25ZQWSiZ4SRigg1vKwM2uj1Lg,1151
|
|
9
|
+
esprit_py-0.2.1.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
|
10
|
+
esprit_py-0.2.1.dist-info/top_level.txt,sha256=aS9besFTZ4EYTsoBJVf3GaMjQtJLgLaK7WqAxSvGVdQ,7
|
|
11
|
+
esprit_py-0.2.1.dist-info/RECORD,,
|
esprit_py-0.1.0.dist-info/RECORD
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
esprit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
esprit/absence_scrape.py,sha256=y7v9JS4ZB3k97KBuM5e2VlesBS8M-siqq0KnlVf1QkA,977
|
|
3
|
-
esprit/auth.py,sha256=He2c7XF8VlzKjQ4CsuTtZfarNsmjPwJszoNfVV5Cgm4,3134
|
|
4
|
-
esprit/credit.py,sha256=isQV2YJQyTtEumfok3sATpiFzsxYM11s6--UNsFkNZQ,1067
|
|
5
|
-
esprit/esprit.py,sha256=UuLK3NRGYBYkjQTIPkQjGJx8UWb5m7hRo3Xk-LKNgVo,1368
|
|
6
|
-
esprit/grade_scrape.py,sha256=k5LjhX2xeoutWpt0HoVM-uwAbRoVE0BSH49uyaxKAhg,974
|
|
7
|
-
esprit/time_schedule_scrape.py,sha256=fCo3HD2xLCPKmibVVEqK16m4oDiWKtHku4MyZZBeSk8,4124
|
|
8
|
-
esprit_py-0.1.0.dist-info/METADATA,sha256=F-TACsJU92OvIln0Vp5gOImT8rHx9Yd1Y5c0-dyNTOg,736
|
|
9
|
-
esprit_py-0.1.0.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
|
10
|
-
esprit_py-0.1.0.dist-info/top_level.txt,sha256=aS9besFTZ4EYTsoBJVf3GaMjQtJLgLaK7WqAxSvGVdQ,7
|
|
11
|
-
esprit_py-0.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|