if description isnotNone: query_string_fragments.append('details=%s' % quote(description))
if location isnotNone: query_string_fragments.append('location=%s' % quote(location))
if iana_timezone_name isnotNone: query_string_fragments.append('ctz=%s' % quote(iana_timezone_name))
query_string = '&'.join(query_string_fragments)
return'%s?%s' % (base_url, query_string)
Example
Suppose you want an event: - Title: Sample Event - Date/Time: June 10, 2024, 2pm to 3:30pm - Description: Don't miss this important meeting! - Location: 123 Main St, New York, NY - Time zone: America/New_York
Here's how you'd create the URL:
1 2 3 4 5 6 7 8 9 10 11
from zoneinfo import ZoneInfo
generate_google_calendar_event_url( title='Sample Event', start_datetime=datetime.datetime(2024, 6, 10, 14, 00), end_datetime=datetime.datetime(2024, 6, 10, 15, 30), description="Don't miss this important meeting!", location='123 Main St, New York, NY', iana_timezone_name='America/New_York' )