I have a server use google calendar API. But today i have a problem.
<HttpError 403 when requesting https://www.googleapis.com/calendar/v3/calendars/9rmkucj5624ove5oe3dvlcchb8%40group.calendar.google.com/events/ilrgnanahon2scuq2hv9u6fcmg?alt=json returned "Calendar usage limits exceeded.">
The json
{
"error": {
"code": 403,
"message": "The request is missing a valid API key.",
"errors": [
{
"message": "The request is missing a valid API key.",
"domain": "global",
"reason": "forbidden"
}
],
"status": "PERMISSION_DENIED"
}
}
But if i use API to creat events, edit events, API worked! My function to add attendee
def update_event_employee_email(service, calendarId, eventId, employee_email,displayName):
# First retrieve the event from the API.
event = service.events().get(calendarId=calendarId, eventId=eventId).execute()
#print(event)
add_attendees = {
"displayName": str(displayName),
"email": str(employee_email)
}
try:
current_attendees = event['attendees']
except Exception as e:
current_attendees=[]
if current_attendees:
attendees = event['attendees']
attendees.append(add_attendees)
body = {
"attendees": attendees
}
print(attendees)
else:
body = {
"attendees": [
{
"displayName": str(displayName),
"email": str(employee_email)
}
]
}
#print(event)
try:
event = service.events().patch(calendarId=calendarId, eventId=eventId, body=body).execute()
print(event)
status = 200
except Exception as e:
print(json.loads(e.content)['error']['code'])
status = 400
return status
I also check the google support Avoid Calendar use limits
And i think my API doesnt over limit
I update: My service build code
# If modifying these scopes, delete the file token.pickle.
SCOPES = ['https://www.googleapis.com/auth/calendar']
def service_build():
"""Shows basic usage of the Google Calendar API.
Prints the start and name of the next 10 events on the user's calendar.
"""
creds = None
# The file token.pickle stores the user's access and refresh tokens, and is
# created automatically when the authorization flow completes for the first
# time.
print(os.path.exists('token.pickle'))
if os.path.exists('token.pickle'):
with open('token.pickle', 'rb') as token:
creds = pickle.load(token)
# If there are no (valid) credentials available, let the user log in.
if not creds or not creds.valid:
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.pickle', 'wb') as token:
pickle.dump(creds, token)
service = build('calendar', 'v3', credentials=creds)
return service
# Call the Calendar API
So i guess my problem Ex: If you have a fresh token you can send any one *. 50 Events having 100 guest - 2 Guests per event *. 25 Events having 100 guest - 4 Guests per event
Limits per
Day: 36 Guests
Week: 252 Guests
Month: ~1080 Guests
So i also want to know, how to buy more limit to add more Guests