API Documentation

A library to work with cron/quartz expressions and timezones.

The library provides a way to define schedules attached to timezones and get time occurrences out of it by just iterating the object created.

See the Schedule class for further details

The key terms used in the documentations are:

  • Schedule: Specification of a successions of occurrences
  • Occurrence: point in time that is satisfied by the specification of a schedule

As an example, a schedule is every tuesday at 2pm in London, an occurrence is next tuesday at 2pm with an offset from utc of +60 minutes.

class tzcron.Schedule(expression, t_zone, start_date=None, end_date=None, filters=None)[source]

Bases: six.Iterator

Schedule allows to get a list of occurrences given a cron specification and tz

Schedule is a class that relying in dateutil.rrule generates a list of occurrences given a schedule, timezone and start-end datetime

Once the Schedule is built, it is iterable. Being each element an occurrence of the schedule

The class provides no support for occurrences falling in DST change times.
It will throw an exception if a schedule falls into a DST change period and advance the iterator. This allows the application to decide on those situations.

Filters allow to specify a filtering condition for the occurrence See the year filter as an example. A good use of it is to skip non business days with a calendar.

next()
exception tzcron.InvalidExpression[source]

Bases: exceptions.Exception

Custom exception when we fail to parse an cron/quartz expression

args
message