esprit-py 0.3.2__tar.gz → 0.3.3__tar.gz

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.

@@ -0,0 +1,67 @@
1
+ Metadata-Version: 2.1
2
+ Name: esprit-py
3
+ Version: 0.3.3
4
+ Summary: A Python library for interacting with data from esprit-tn.com
5
+ Home-page: https://github.com/TheLime1/esprit.py
6
+ Author: Lime1 (Aymen Hmani)
7
+ Keywords: python,api
8
+ Classifier: Development Status :: 1 - Planning
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Operating System :: Unix
12
+ Classifier: Operating System :: MacOS :: MacOS X
13
+ Classifier: Operating System :: Microsoft :: Windows
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+
17
+
18
+ # <img src="https://esprit.tn/favicon.ico" width="28px" /> esprit-py
19
+
20
+ > [!NOTE]
21
+ > Please note that this library is not an official API provided by Esprit and is intended for educational and personal use only.
22
+
23
+ ## Features
24
+
25
+ - Get your exact timetable pdf *not 300 pages pdf*
26
+ - Get your grades
27
+ - Get your absences
28
+ - Get your credits
29
+
30
+ ## Installation
31
+
32
+ ```bash
33
+ pip install esprit-py
34
+ ```
35
+
36
+ download `chromedriver` from [here](https://googlechromelabs.github.io/chrome-for-testing/#stable)
37
+
38
+ ## Example
39
+
40
+ ```python
41
+ from esprit import Esprit
42
+
43
+ # Create an Esprit object
44
+ esprit = Esprit(
45
+ driver_path="C:/path/to/chromedriver.exe",)
46
+
47
+ # Replace with your actual ID and password
48
+ id = 'ID'
49
+ password = 'PASSWORD'
50
+
51
+ # Attempt to log in
52
+ if esprit.login(id, password):
53
+ print("Login successful.")
54
+ else:
55
+ print("Login failed.")
56
+
57
+ # Get absences
58
+ absences = esprit.get_absences()
59
+ if absences is not None:
60
+ for absence in absences:
61
+ print(absence)
62
+ else:
63
+ print("Failed to get absences.")
64
+
65
+ ```
66
+
67
+ More examples can be found in the [examples folder](examples)
@@ -1,45 +1,50 @@
1
- # <img src="https://esprit.tn/favicon.ico" width="28px" /> esprit-py
2
-
3
- > [!NOTE]
4
- > Please note that this library is not an official API provided by Esprit and is intended for educational and personal use only.
5
-
6
- ## Features
7
-
8
- - Get your exact timetable pdf *not 300 pages pdf*
9
- - Get your grades
10
- - Get your absences
11
- - Get your credits
12
-
13
- ## Installation
14
-
15
- ```bash
16
- pip install esprit-py
17
- ```
18
-
19
- ## Example
20
-
21
- ```python
22
- from esprit import Esprit
23
-
24
- # Create an Esprit object
25
- esprit = Esprit()
26
-
27
- # Replace with your actual ID and password
28
- id = 'ID'
29
- password = 'PASSWORD'
30
-
31
- # Attempt to log in
32
- if esprit.login(id, password):
33
- print("Login successful.")
34
- else:
35
- print("Login failed.")
36
-
37
- # Get absences
38
- absences = esprit.get_absences()
39
- if absences is not None:
40
- for absence in absences:
41
- print(absence)
42
- else:
43
- print("Failed to get absences.")
44
- ```
1
+ # <img src="https://esprit.tn/favicon.ico" width="28px" /> esprit-py
2
+
3
+ > [!NOTE]
4
+ > Please note that this library is not an official API provided by Esprit and is intended for educational and personal use only.
5
+
6
+ ## Features
7
+
8
+ - Get your exact timetable pdf *not 300 pages pdf*
9
+ - Get your grades
10
+ - Get your absences
11
+ - Get your credits
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ pip install esprit-py
17
+ ```
18
+
19
+ download `chromedriver` from [here](https://googlechromelabs.github.io/chrome-for-testing/#stable)
20
+
21
+ ## Example
22
+
23
+ ```python
24
+ from esprit import Esprit
25
+
26
+ # Create an Esprit object
27
+ esprit = Esprit(
28
+ driver_path="C:/path/to/chromedriver.exe",)
29
+
30
+ # Replace with your actual ID and password
31
+ id = 'ID'
32
+ password = 'PASSWORD'
33
+
34
+ # Attempt to log in
35
+ if esprit.login(id, password):
36
+ print("Login successful.")
37
+ else:
38
+ print("Login failed.")
39
+
40
+ # Get absences
41
+ absences = esprit.get_absences()
42
+ if absences is not None:
43
+ for absence in absences:
44
+ print(absence)
45
+ else:
46
+ print("Failed to get absences.")
47
+
48
+ ```
49
+
45
50
  More examples can be found in the [examples folder](examples)
@@ -11,7 +11,6 @@ class Esprit:
11
11
  self.session = requests.Session()
12
12
  self.auth = Auth(driver_path, driver, debug, headless)
13
13
  self.grade_scrape = Grade(self.session)
14
- self.grade_scrape = Grade(self.session)
15
14
  self.absence_scrape = Absence(self.session)
16
15
  self.time_schedule_scrape = TimeSchedule(self.session)
17
16
  self.credit = Credit(self.session)
@@ -24,6 +23,9 @@ class Esprit:
24
23
  def get_grades(self):
25
24
  return self.grade_scrape.get_grades()
26
25
 
26
+ def calculate_average(self, grades):
27
+ return self.grade_scrape.calculate_average(grades)
28
+
27
29
  def get_absences(self):
28
30
  return self.absence_scrape.get_absences()
29
31
 
@@ -1,5 +1,7 @@
1
1
  import requests
2
2
  from bs4 import BeautifulSoup
3
+ import pandas as pd
4
+ import numpy as np
3
5
 
4
6
 
5
7
  class Grade:
@@ -50,3 +52,39 @@ class Grade:
50
52
  grades = [headers] + [[cell.text.strip() for cell in row.find_all('td')]
51
53
  for row in rows[1:]] # Skip header row
52
54
  return grades
55
+
56
+ def calculate_average(self, grades):
57
+ # Convert the list of lists to a DataFrame
58
+ df = pd.DataFrame(grades[1:], columns=grades[0])
59
+
60
+ # Replace empty strings with NaN
61
+ df.replace('', np.nan, inplace=True)
62
+
63
+ # Replace comma with dot and convert to float
64
+ for col in ['COEF', 'NOTE_CC', 'NOTE_TP', 'NOTE_EXAM']:
65
+ df[col] = df[col].str.replace(',', '.').astype(float)
66
+
67
+ # Calculate the average based on available grades
68
+
69
+ def calculate_average(row):
70
+ if pd.isna(row['NOTE_TP']):
71
+ if pd.isna(row['NOTE_CC']):
72
+ return row['NOTE_EXAM']
73
+ else:
74
+ return row['NOTE_EXAM'] * 0.6 + row['NOTE_CC'] * 0.4
75
+ elif pd.isna(row['NOTE_CC']):
76
+ return row['NOTE_EXAM'] * 0.8 + row['NOTE_TP'] * 0.2
77
+ else:
78
+ return row['NOTE_EXAM'] * 0.5 + row['NOTE_CC'] * 0.3 + row['NOTE_TP'] * 0.2
79
+
80
+ df['MOYENNE'] = df.apply(calculate_average, axis=1)
81
+
82
+ # Calculate the total average
83
+ total_average = (df['MOYENNE'] * df['COEF']).sum() / df['COEF'].sum()
84
+
85
+ # Append the total average to the DataFrame
86
+ df = df._append({'DESIGNATION': 'Moyenne', 'COEF': df['COEF'].sum(
87
+ ), 'MOYENNE': total_average}, ignore_index=True)
88
+
89
+ print(df)
90
+ return total_average
@@ -0,0 +1,67 @@
1
+ Metadata-Version: 2.1
2
+ Name: esprit-py
3
+ Version: 0.3.3
4
+ Summary: A Python library for interacting with data from esprit-tn.com
5
+ Home-page: https://github.com/TheLime1/esprit.py
6
+ Author: Lime1 (Aymen Hmani)
7
+ Keywords: python,api
8
+ Classifier: Development Status :: 1 - Planning
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Operating System :: Unix
12
+ Classifier: Operating System :: MacOS :: MacOS X
13
+ Classifier: Operating System :: Microsoft :: Windows
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+
17
+
18
+ # <img src="https://esprit.tn/favicon.ico" width="28px" /> esprit-py
19
+
20
+ > [!NOTE]
21
+ > Please note that this library is not an official API provided by Esprit and is intended for educational and personal use only.
22
+
23
+ ## Features
24
+
25
+ - Get your exact timetable pdf *not 300 pages pdf*
26
+ - Get your grades
27
+ - Get your absences
28
+ - Get your credits
29
+
30
+ ## Installation
31
+
32
+ ```bash
33
+ pip install esprit-py
34
+ ```
35
+
36
+ download `chromedriver` from [here](https://googlechromelabs.github.io/chrome-for-testing/#stable)
37
+
38
+ ## Example
39
+
40
+ ```python
41
+ from esprit import Esprit
42
+
43
+ # Create an Esprit object
44
+ esprit = Esprit(
45
+ driver_path="C:/path/to/chromedriver.exe",)
46
+
47
+ # Replace with your actual ID and password
48
+ id = 'ID'
49
+ password = 'PASSWORD'
50
+
51
+ # Attempt to log in
52
+ if esprit.login(id, password):
53
+ print("Login successful.")
54
+ else:
55
+ print("Login failed.")
56
+
57
+ # Get absences
58
+ absences = esprit.get_absences()
59
+ if absences is not None:
60
+ for absence in absences:
61
+ print(absence)
62
+ else:
63
+ print("Failed to get absences.")
64
+
65
+ ```
66
+
67
+ More examples can be found in the [examples folder](examples)
@@ -2,3 +2,5 @@ requests
2
2
  beautifulsoup4
3
3
  PyPDF2
4
4
  selenium
5
+ numpy
6
+ pandas
@@ -11,7 +11,7 @@ with codecs.open(os.path.join(here, "README.md"), encoding="utf-8") as fh:
11
11
  with open(os.path.join(here, 'requirements.txt')) as f:
12
12
  requirements = f.read().splitlines()
13
13
 
14
- VERSION = '0.3.2'
14
+ VERSION = '0.3.3'
15
15
  DESCRIPTION = ' A Python library for interacting with data from esprit-tn.com'
16
16
  LONG_DESCRIPTION = 'esprit-py, provides a set of tools for interacting with data from the Esprit website. It includes functionalities for scraping grades, absences, time schedules, and credits. It also provides the ability to download files and get class week schedules.'
17
17
 
esprit-py-0.3.2/PKG-INFO DELETED
@@ -1,62 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: esprit-py
3
- Version: 0.3.2
4
- Summary: A Python library for interacting with data from esprit-tn.com
5
- Home-page: https://github.com/TheLime1/esprit.py
6
- Author: Lime1 (Aymen Hmani)
7
- Keywords: python,api
8
- Classifier: Development Status :: 1 - Planning
9
- Classifier: Intended Audience :: Developers
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: Operating System :: Unix
12
- Classifier: Operating System :: MacOS :: MacOS X
13
- Classifier: Operating System :: Microsoft :: Windows
14
- Description-Content-Type: text/markdown
15
- License-File: LICENSE
16
-
17
-
18
- # <img src="https://esprit.tn/favicon.ico" width="28px" /> esprit-py
19
-
20
- > [!NOTE]
21
- > Please note that this library is not an official API provided by Esprit and is intended for educational and personal use only.
22
-
23
- ## Features
24
-
25
- - Get your exact timetable pdf *not 300 pages pdf*
26
- - Get your grades
27
- - Get your absences
28
- - Get your credits
29
-
30
- ## Installation
31
-
32
- ```bash
33
- pip install esprit-py
34
- ```
35
-
36
- ## Example
37
-
38
- ```python
39
- from esprit import Esprit
40
-
41
- # Create an Esprit object
42
- esprit = Esprit()
43
-
44
- # Replace with your actual ID and password
45
- id = 'ID'
46
- password = 'PASSWORD'
47
-
48
- # Attempt to log in
49
- if esprit.login(id, password):
50
- print("Login successful.")
51
- else:
52
- print("Login failed.")
53
-
54
- # Get absences
55
- absences = esprit.get_absences()
56
- if absences is not None:
57
- for absence in absences:
58
- print(absence)
59
- else:
60
- print("Failed to get absences.")
61
- ```
62
- More examples can be found in the [examples folder](examples)
@@ -1,62 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: esprit-py
3
- Version: 0.3.2
4
- Summary: A Python library for interacting with data from esprit-tn.com
5
- Home-page: https://github.com/TheLime1/esprit.py
6
- Author: Lime1 (Aymen Hmani)
7
- Keywords: python,api
8
- Classifier: Development Status :: 1 - Planning
9
- Classifier: Intended Audience :: Developers
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: Operating System :: Unix
12
- Classifier: Operating System :: MacOS :: MacOS X
13
- Classifier: Operating System :: Microsoft :: Windows
14
- Description-Content-Type: text/markdown
15
- License-File: LICENSE
16
-
17
-
18
- # <img src="https://esprit.tn/favicon.ico" width="28px" /> esprit-py
19
-
20
- > [!NOTE]
21
- > Please note that this library is not an official API provided by Esprit and is intended for educational and personal use only.
22
-
23
- ## Features
24
-
25
- - Get your exact timetable pdf *not 300 pages pdf*
26
- - Get your grades
27
- - Get your absences
28
- - Get your credits
29
-
30
- ## Installation
31
-
32
- ```bash
33
- pip install esprit-py
34
- ```
35
-
36
- ## Example
37
-
38
- ```python
39
- from esprit import Esprit
40
-
41
- # Create an Esprit object
42
- esprit = Esprit()
43
-
44
- # Replace with your actual ID and password
45
- id = 'ID'
46
- password = 'PASSWORD'
47
-
48
- # Attempt to log in
49
- if esprit.login(id, password):
50
- print("Login successful.")
51
- else:
52
- print("Login failed.")
53
-
54
- # Get absences
55
- absences = esprit.get_absences()
56
- if absences is not None:
57
- for absence in absences:
58
- print(absence)
59
- else:
60
- print("Failed to get absences.")
61
- ```
62
- More examples can be found in the [examples folder](examples)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes