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')
print("________________________________") print(str(teacher)) print("________________________________") elif vyber == 2: call("clear") ziaci = edu.get_students() ziaci.sort(key=EduStudent.__sort__) for ziaci in ziaci: print("________________________________") print(f"{ziaci.number_in_class}: {ziaci.fullname}") elif vyber == 3: call("clear") du = edu.get_homework() for hw in du: call("clear") print("________________________________") print(hw.subject) print(hw.title) print(hw.description) print(hw.due_date) print("________________________________") elif vyber == 4: dnes = EduDate.today() rozvrh = edu.get_timetable(dnes) prva = rozvrh.get_first_lesson()