Reputation: 57
Using Google Calendar's api with python, I added an event with a source url. It doesn't display the title of the source url on the web and it doesn't display the url at all on the google calendar's android app. Is there an issue with my code? Or, is there a bug in google calendar?
This is the source parameter I used:
'source': {
'url': 'https://www.nps.gov/grte/planyourvisit/bcres.htm',
'title': 'NPS Permit website'
},
Here is my entire code:
from __future__ import print_function
from datetime import date, timedelta
import datetime
import calendar
import httplib2
import os
from apiclient import discovery
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage
try:
import argparse
flags = argparse.ArgumentParser(parents=[tools.argparser]).parse_args()
except ImportError:
flags = None
def get_credentials():
home_dir = os.path.expanduser('~')
credential_dir = os.path.join(home_dir, '.credentials')
if not os.path.exists(credential_dir):
os.makedirs(credential_dir)
credential_path = os.path.join(credential_dir,
'calendar-python-quickstart.json')
store = Storage(credential_path)
credentials = store.get()
if not credentials or credentials.invalid:
flow = client.flow_from_clientsecrets(CLIENT_SECRET_FILE, SCOPES)
flow.user_agent = APPLICATION_NAME
if flags:
credentials = tools.run_flow(flow, store, flags)
else: # Needed only for compatibility with Python 2.6
credentials = tools.run(flow, store)
print('Storing credentials to ' + credential_path)
return credentials
def main():
credentials = get_credentials()
http = credentials.authorize(httplib2.Http())
service = discovery.build('calendar', 'v3', http=http)
cal_id = '[email protected]'
cal_body = {
'start': {
'date': '2018-01-03',
'timeZone': 'America/Los_Angeles'
},
'end': {
'date': '2018-01-03',
'timeZone': 'America/Los_Angeles'
},
'summary': 'Event Title',
'source': {
'url': 'https://www.nps.gov/grte/planyourvisit/bcres.htm',
'title': 'NPS Permit website'
},
'recurrence': ['RRULE:FREQ=YEARLY;BYMONTH=1;BYSETPOS=1;BYDAY=WE']
}
event = service.events().insert(calendarId=cal_id,body=cal_body ).execute()
print(cal_body)
Upvotes: 1
Views: 424
Reputation: 11
Yes, this looks like a bug in Google Calendar API. You can find this bug in the issue tracker here: https://issuetracker.google.com/issues/73334552
Upvotes: 1