Skip to main content

croniter provides iteration for datetime object with cron like format

Project description

Simple example of usage is followings

>>> from croniter import croniter
>>> from datetime import datetime
>>> base = datetime(2010, 1, 25, 4, 46)
>>> iter = croniter('*/5 * * * *', base)  # every 5 minites
>>> print iter.get_next(datetime)   # 2010-01-25 04:50:00
>>> print iter.get_next(datetime)   # 2010-01-25 04:55:00
>>> print iter.get_next(datetime)   # 2010-01-25 05:00:00
>>>
>>> iter = croniter('2 4 * * mon,fri', base)  # 04:02 on every Monday and Friday
>>> print iter.get_next(datetime)   # 2010-01-26 04:02:00
>>> print iter.get_next(datetime)   # 2010-01-30 04:02:00
>>> print iter.get_next(datetime)   # 2010-02-02 04:02:00

All you need to know is constructor and get_next, these signature are following.

>>> def __init__(self, cron_format, start_time=time.time())

croniter iterate along with ‘cron_format’ from ‘start_time’. cron_format is ‘min hour day month day_of_week’, and please refer to http://en.wikipedia.org/wiki/Cron for details.

>>> def get_next(self, ret_type=float)

get_next return next time in iteration with ‘ret_type’. And ret_type accept only ‘float’ or ‘datetime’.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

croniter-0.1.4.tar.gz (4.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

croniter-0.1.4.macosx-10.5-i386.tar.gz (8.1 kB view details)

Uploaded Source

croniter-0.1.4-py2.5.egg (10.8 kB view details)

Uploaded Egg

File details

Details for the file croniter-0.1.4.tar.gz.

File metadata

  • Download URL: croniter-0.1.4.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for croniter-0.1.4.tar.gz
Algorithm Hash digest
SHA256 7cb43fe7a76dbc40e03753eafbaf74da955f1d2c6fab94146f000e25a23db75b
MD5 a7c0f1e46a194cdec4e07561f96adf3f
BLAKE2b-256 826155bb3abc8f395b55fa31737246a662074f8eb0aa0658ce0464034b0112b7

See more details on using hashes here.

File details

Details for the file croniter-0.1.4.macosx-10.5-i386.tar.gz.

File metadata

File hashes

Hashes for croniter-0.1.4.macosx-10.5-i386.tar.gz
Algorithm Hash digest
SHA256 3494691c0a5204db51b305c59646fa826482c4a6a1ba1b05bc18e8b52de02275
MD5 e0ad8bf97e4c5b40def8fcfe025eff8f
BLAKE2b-256 67f64da6cc9ce50c95b108555883c6de1eef6f49e83f877baac6ec463da614d8

See more details on using hashes here.

File details

Details for the file croniter-0.1.4-py2.5.egg.

File metadata

  • Download URL: croniter-0.1.4-py2.5.egg
  • Upload date:
  • Size: 10.8 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for croniter-0.1.4-py2.5.egg
Algorithm Hash digest
SHA256 3d60bff9066cfbe4c5d8133a593c9e4384b34dfdafd7ba12e6bf7979f3f66b77
MD5 27c75bb9fd84533765dfffae5bdff711
BLAKE2b-256 4eaf39c475691d7671073471b7e2cf42c7f27c5fdb789e42e3ea386109412193

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page