Kosmorrolib Documentation

search_events()

Return list of matching events that occur in a given time range

Signature

def search_events(
    event_types: [EventType],
    end: datetime.date,
    start: datetime.date = date.today(),
    timezone: int = 0
) -> [Event]

Arguments

  • event_types: the type of events that will be searched for
  • end: events earlier than this date will be included in search
  • start: events later than this date will be included in search
  • timezone: if set, the datetime returned will be adapted to the given timezone

Return

A list of events, matching event types, that represent astronomical events occurring in the given time range

Examples

Get conjunction and season change events between June 17th, 2021 and June 19th, 2021:

event_types = [EventType.CONJUNCTION, EventType.SEASON_CHANGE]
kosmorrolib.search_events(event_types, end=date(2021, 6, 19), start=date(2021, 6, 17))

See also

Help us to improve this page, contribute to the documentation!