Hi please assist me in implementing code for updating the data file of the following code.
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())