def login(self): # 1. self.domain_edit 2. self.user_edit 3. self.pass_edit domain = self.domain_edit.text() user = self.user_edit.text() password = self.pass_edit.text() try: self.edu = Edupage(domain, user, password) try: self.edu.login() self.login_formular.hide() eci = EdupageClientIndex(self) eci.index_formular.show() except BadCredentialsException: self.render_err( "Bad credentials", "Check login credentials (username/password)!") except LoginDataParsingException: self.render_err( "Login data parsing", "Check internet connection, try again later or contact server " "administrators!") except UnicodeError: return except IndexError: self.render_err( "Indexing error", "Check entered domain, if correct then check internet connection or est!" )
def main(): #AUTH STUFF creds = None if os.path.exists('token.json'): creds = Credentials.from_authorized_user_file('token.json', SCOPES) else: if creds and creds.expired and creds.refresh_token: creds.refresh(Request()) else: flow = InstalledAppFlow.from_client_secrets_file( 'credentials.json', SCOPES) creds = flow.run_local_server(port=0) # Save the credentials for the next run with open('token.json', 'w') as token: token.write(creds.to_json()) service = build('calendar', 'v3', credentials=creds) #EDUPAGE STUFF login = input("Enter your edupage login: "******"Enter your edupage password: "******"%Y-%d-%m").strftime("%Y-%m-%d") yest = datetime.now() - timedelta(1) print('\n\n\n') if datetime.strptime(dateSting, "%Y-%m-%d") > yest: event = { 'summary': hw.title, 'description': hw.description, 'start': { 'dateTime': '{0}T09:00:00-07:00'.format(dateSting), 'timeZone': 'Etc/GMT', }, 'end': { 'dateTime': '{0}T09:00:00-07:00'.format(dateSting), 'timeZone': 'Etc/GMT', }, } if times < 9: times = times + 1 else: times = 2 event = service.events().insert(calendarId='primary', body=event).execute() print('Event created: {}'.format(event.get('htmlLink'))) else: print('Too old')
from edupage_api import Edupage edupage = Edupage() edupage.login_auto("Username (or e-mail)", "Password") grades = edupage.get_grades() grades_by_subject = {} for grade in grades: if grades_by_subject.get(grade.subject_name): grades_by_subject[grade.subject_name] += [grade] else: grades_by_subject[grade.subject_name] = [grade] for subject in grades_by_subject: print(f"{subject}:") for grade in grades_by_subject[subject]: print(f" {grade.title} -> ", end="") if grade.max_points != 100: print(f"{grade.grade_n}/{grade.max_points}") else: print(f"{grade.percent}%") print("----------------")
from datetime import datetime from edupage_api import Edupage, EduDate, EduTimetable, EduTime, EduLength import telebot import time groupId = -1001163700495 edupage = Edupage("sdc", "*****@*****.**", "Ansar2003") edupage.login() bot = telebot.TeleBot('1724837486:AAHSCeHaZeyxW03Qd5TzEK7XCwgCGNDe53k') @bot.message_handler(commands=['hw']) def hw(message): try: for hw in edupage.get_homework(): bot.send_message(groupId, hw) except: bot.send_message(groupId, 'Не удалось получить данные.') lessonTime = EduTime(0, 0) @bot.message_handler(commands=['lesson']) def nextLesson(message): try: if str( edupage.get_timetable(EduDate.today()).get_next_lesson_at_time( EduTime.now())) != 'None': bot.send_message( groupId, 'Следующий урок \n' +
from edupage_api import Edupage, EduStudent, BadCredentialsException, LoginDataParsingException, EduDate from subprocess import call dom = input("Definuj doménu: (iba začiatok bez .edupage.org): ") meno = input("Vlož prihlasovacie meno: ") heslo = input("Vlož svoje heslo: ") edu = Edupage(dom, meno, heslo) try: call("clear") edu.login() print("Úspešne prihlásený ako ", meno, "na doméne", dom) print("1. Zobraziť list učiteľov (nefunkcne)") print("2. Zobraziť list spolužiakov") print("3. Úlohy") print("4. Rozvrh") vyber = int(input("Vitaj! Čo chceš robiť? ")) if vyber == 1: call("clear") uc = edu.get_teachers() for teacher in uc: print("________________________________") print(str(teacher)) print("________________________________") elif vyber == 2: call("clear") ziaci = edu.get_students() ziaci.sort(key=EduStudent.__sort__)