Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hi please assist me in implementing code for updating the data file of the following code. def volunteers_input (): next_7_days = [] time = []
Hi please assist me in implementing code for updating the data file of the following code.
Volunteer for a slot As a student that wants to volunteer their time in the coding clinic, I want to indicate my availability for a specific slot. - Do not allow double booking for volunteers - The booking should also show on the volunteer's personal Google Calendar - The data file for the volunteer should be updated as well def volunteers_input():
next_7_days = []
time = []
for day in range(7):
next_7_days.append(str(datetime.now()+datetime.
timedelta
(days=day))[:10]) for times in range(8):
time.append(str(datetime.now()+datetime.timedelta(
hours
=times))[11:19]) print(next_7_days)
print(time)
while True:
user_input = input("Acceptable format[yyyy-mm-dd]
Input date: "
)# user_input = input("Acceptable format[hh:mm] Input time: ")
if user_input in next_7_days:
break
return user_input
# volunteers_input()
def check_time():
while True:
user_input = input("Acceptable format[hh:mm]
Input time: "
) time = user_input.split(':')
hour = int(time[0])
min = int(time[1])
if hour 16 and hour > 8:
if min >= 0 and min 60:
break
return user_input
# check_time()
def create_event(service):
date = volunteers_input()
time = check_time()
event = {
'summary': 'volunteer',
'location': '84 Albertinah Sisulu St., Johannesburg, 2000',
'description':
'A chance to hear more about Code clinics calendar.'
, 'start': {
'dateTime': f'{date}T{time}:00-07:00',
'timeZone': 'Africa/Johannesburg',
},
'end': {
'dateTime': f'{date}T{time[:2]}:30:00-07:00',
'timeZone': 'Africa/Johannesburg',
},
'recurrence': [
'RRULE:FREQ=DAILY;COUNT=1'
],
'attendees': [
{'email': 'sinkabi022@student.wethinkcode.co.za'}
],
'reminders': {
'useDefault': False,
'overrides': [
{'method': 'email', 'minutes': 24 * 60},
{'method': 'popup', 'minutes': 10},
],
},
}
event = service.events().insert(calendarId=
'c_9hvu4b3796ulvqfh3vk2brri6o@group.calendar.google.com'
, body=event).execute() event = service.events().insert(calendarId='primary', body=
event
).execute() print('Event created: %s' % (event.get('htmlLink')))
create_event(authentification())
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started