from pprint import pprint import pickle import datetime import os from google_auth_oauthlib.flow import Flow, InstalledAppFlow from googleapiclient.discovery import build from googleapiclient.http import MediaFileUpload from google.auth.transport.requests import Request from create_slot import create_Service, convert_to_RFC_datetime, get_calendar import setup as config import configure args = configure.set_parser() username = config.get_users_home_dir() hour, minutes = configure.get_time(args) year, month, day = configure.get_date(args) CLIENT_SECRET_FILE = 'credentials.json' API_NAME = 'calendar' API_VERSION = 'v3' SCOPES = ['https://www.googleapis.com/auth/calendar'] def cancel_booking(service, eventId): """ Function cancels the booking. """ print('Deleting booking...') service.events().delete(calendarId='primary', eventId=eventId).execute() print('Booking deleted.') return True
import argparse import os import setup import sys user_name = setup.get_users_home_dir() email = setup.get_email(user_name, '') year = 0 month = 0 day = 0 hour = 0 minutes = 0 months = [ 'Jan', 'Feb', 'Mar', 'Apr', 'Mar', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ] something = [] def get_email(args): """ This function asks the users for their student/volunteer email address, if they dont put in anything we get it for them and rerurn the email. """ # print(user) if not args.n: os.chdir(f'/goinfre/{user_name.strip()}/.config/wtc') f = open('config.yml') a = f.readlines() key, val = a[4].split(':', 1) email = val[:-1]