-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: 💍 added try except to make the code more robust
- Loading branch information
Showing
6 changed files
with
136 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.env | ||
__pycache__/ | ||
/node_modules | ||
/node_modules | ||
*.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
|
||
import json | ||
import time | ||
|
||
from dotenv import load_dotenv | ||
from Inquirer import Inquirer | ||
|
||
import inquirer | ||
|
||
from Inquirer import Inquirer | ||
from MyDashboard import MyDashboard | ||
from NotionClient import NotionClient | ||
from joblib import Parallel, delayed | ||
from utils.read_data_from_csv import read_emails_from_csv | ||
|
||
load_dotenv() | ||
|
||
|
||
if __name__ == '__main__': | ||
|
||
# https://www.notion.so/9462e15053ff4bbc871ad7ab91d9f145?v=632479bcc69b41ce8ff355d5c72dcdfb | ||
# https://www.notion.so/812372d76eb4492f81089f79f3cddefa?v=aed9d7af707b4527a37fda7295ec7a34 | ||
# https://www.notion.so/eeee053ef4ec44e6a666382bd54a1b39?v=2ad8662f2b2a465186d8854289950e9b | ||
# https://www.notion.so/812372d76eb4492f81089f79f3cddefa?v=aed9d7af707b4527a37fda7295ec7a34 | ||
# https://www.notion.so/eeee053ef4ec44e6a666382bd54a1b39?v=2ad8662f2b2a465186d8854289950e9b | ||
|
||
print('--- Started the script ---') | ||
|
||
start = time.process_time() | ||
''' ''' | ||
my_dashboard = MyDashboard(['4725', '4731', '4732']) | ||
# print(my_dashboard.print_json(my_dashboard.get_students())) | ||
student_key = my_dashboard.get_student_key_with_email( | ||
'abdelaty.magdi@gmail.com') | ||
print(student_key) | ||
#inq = Inquirer(my_dashboard) | ||
|
||
''' inquirer.Path('file_path', message='Please type the csv file path', | ||
path_type=inquirer.Path.DIRECTORY) | ||
answers = inquirer.prompt([inquirer.Path('file_path', message='Please type the csv file path', | ||
path_type=inquirer.Path.DIRECTORY)]) ''' | ||
|
||
# todo: add a method to create an attendance record if it doesn't exist | ||
inq = Inquirer(my_dashboard) | ||
#inq.execute_command('I want to update my students\'s progress on notion') | ||
|
||
print('Finished in: ', time.process_time() - start) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
import csv | ||
|
||
|
||
def read_emails_from_csv(file_path: str = 'attendance.csv'): | ||
with open(file_path, 'r') as file: | ||
csvreader = csv.reader(file) | ||
emails = [] | ||
for row in csvreader: | ||
# print(row) | ||
if row[2] == 'Email': | ||
continue | ||
emails.append(row[2]) | ||
return emails |