widgets

Get the current Python events from an ics file and format them into a markdown string.

exception src.widgets.events.FetchFailedError[source]

Bases: Exception

Raised when the fetch fails for any reason.

async src.widgets.events.fetch_ics(url: str) Any[source]

Fetches the ics file from the given url and returns the text content.

Parameters:

url (str) – The url to fetch the ics file from

Raises:

FetchFailedException – If the fetch fails for any reason

Returns:

The text content of the ics file

Return type:

str

src.widgets.events.format_event(event_time_start: Arrow, event_time_end: Arrow | None, summary: str, link: str) str[source]

Formats the event into a markdown string.

Parameters:
  • event_time_start (arrow.Arrow) – The start time of the event

  • event_time_end (arrow.Arrow) – The end time of the event

  • summary (str) – The summary of the event

  • link (str) – The link to the event

Returns:

The markdown string

Return type:

str

async src.widgets.events.main() None[source]

Make events go brr.

src.widgets.events.parse_ics_to_md(ics_str: str) str[source]

Parses the ics string into a markdown string.

Parameters:

ics_str (str) – The ics string to parse

Returns:

The markdown string

Return type:

str

async src.widgets.events.write_to_md_file(content: str, file_path: str) None[source]

Writes the content to the given file path.

Parameters:
  • content (str) – The content to write

  • file_path (str) – The file path to write to