
Security News
pnpm 10.16 Adds New Setting for Delayed Dependency Updates
pnpm's new minimumReleaseAge setting delays package updates to prevent supply chain attacks, with other tools like Taze and NCU following suit.
Generate calendar links and ICS files for Google, Apple, Yahoo, AOL, Microsoft 365, and more
A Python package for generating calendar links and ICS files for various calendar services including Google Calendar, Apple Calendar, Yahoo Calendar, AOL Calendar, and Microsoft 365.
pip install calendar-link
from datetime import datetime
from calendar_link import CalendarEvent, CalendarGenerator
# Create an event
event = CalendarEvent(
title="Team Meeting",
start_time=datetime(2024, 1, 15, 10, 0), # 10:00 AM
end_time=datetime(2024, 1, 15, 11, 0), # 11:00 AM
description="Weekly team sync meeting",
location="Conference Room A",
attendees=["john@example.com", "jane@example.com"]
)
# Generate calendar links
generator = CalendarGenerator()
# Generate Google Calendar link
google_link = generator.generate_link(event, "google")
print(f"Google Calendar: {google_link}")
# Generate ICS file content
ics_content = generator.generate_ics(event)
print(f"ICS Content:\n{ics_content}")
# Generate all links at once
all_links = generator.generate_all_links(event)
for service, link in all_links.items():
print(f"{service}: {link}")
from calendar_link import CalendarEvent
event_data = {
"title": "Birthday Party",
"start_time": "2024-02-15T18:00:00",
"end_time": "2024-02-15T22:00:00",
"description": "Come celebrate!",
"location": "My House",
"all_day": False
}
event = CalendarEvent.from_dict(event_data)
import pytz
from datetime import datetime
from calendar_link import CalendarEvent
# Create event with specific timezone
ny_tz = pytz.timezone("America/New_York")
start_time = ny_tz.localize(datetime(2024, 1, 15, 10, 0))
event = CalendarEvent(
title="Meeting",
start_time=start_time,
end_time=start_time.replace(hour=11),
timezone="America/New_York"
)
from datetime import datetime
from calendar_link import CalendarEvent
event = CalendarEvent(
title="Vacation Day",
start_time=datetime(2024, 1, 15, 0, 0),
end_time=datetime(2024, 1, 15, 0, 0),
all_day=True
)
from calendar_link import CalendarEvent, CalendarGenerator
event = CalendarEvent(
title="Important Meeting",
start_time=datetime(2024, 1, 15, 14, 30),
end_time=datetime(2024, 1, 15, 15, 30),
description="Don't forget to prepare the presentation"
)
generator = CalendarGenerator()
ics_content = generator.generate_ics(event)
# Save to file
with open("meeting.ics", "w") as f:
f.write(ics_content)
The main class for representing calendar events.
CalendarEvent(
title: str,
start_time: datetime,
end_time: Optional[datetime] = None,
description: Optional[str] = None,
location: Optional[str] = None,
attendees: Optional[List[str]] = None,
all_day: bool = False,
timezone: Optional[str] = None
)
from_dict(data: dict) -> CalendarEvent
: Create event from dictionaryto_dict() -> dict
: Convert event to dictionaryget_duration_minutes() -> int
: Get event duration in minutesis_same_day() -> bool
: Check if start and end are on same dayThe main class for generating calendar links and ICS files.
generate_link(event: CalendarEvent, service: str) -> str
: Generate link for specific servicegenerate_ics(event: CalendarEvent) -> str
: Generate ICS file contentgenerate_all_links(event: CalendarEvent) -> Dict[str, str]
: Generate all linksget_supported_services() -> Dict[str, str]
: Get list of supported servicesgoogle
: Google Calendarapple
: Apple Calendaryahoo
: Yahoo Calendaraol
: AOL Calendaroutlook
: Microsoft Outlookoffice365
: Microsoft 365ics
: ICS FileThe package includes custom exceptions for better error handling:
from calendar_link import CalendarLinkError, InvalidEventDataError, UnsupportedCalendarServiceError
try:
event = CalendarEvent(title="", start_time=datetime.now()) # Invalid title
except InvalidEventDataError as e:
print(f"Invalid event data: {e}")
try:
generator.generate_link(event, "unsupported_service")
except UnsupportedCalendarServiceError as e:
print(f"Unsupported service: {e}")
The package also includes utility functions for common operations:
from calendar_link.utils import parse_datetime, validate_email, sanitize_text
# Parse datetime with timezone
dt = parse_datetime("2024-01-15 10:00:00", "America/New_York")
# Validate email
is_valid = validate_email("user@example.com")
# Sanitize text for calendar services
clean_text = sanitize_text("Event\nDescription\nwith\nnewlines")
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
Generate calendar links and ICS files for Google, Apple, Yahoo, AOL, Microsoft 365, and more
We found that calendar-link demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm's new minimumReleaseAge setting delays package updates to prevent supply chain attacks, with other tools like Taze and NCU following suit.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.