A simple Python Cron Expression lib
Project description
Python Cron Expression
This is a simple library for making cron job expression. User need to pass timestamp or datetime object to create cron job expression.
Installation
pip install PyCronExpression
Example
from datetime import datetime
from py_cron_expression.py_cron import CronJobExpression
cron_job = CronJobExpression()
timestamp = int(datetime.now().timestamp())
res = cron_job.cron_expression(time=timestamp)
print(res)
# Output
# 10 55 13 2 5 ? 2020
# If you want to remove second from in your cron job expression.
# Then you need to add cancel='second'
# example
cron_job.cron_expression(time=timestamp, cancel='second')
# Output
# 55 13 2 5 ? 2020
If you need to convert the cron job expression to other timezone. Please follow the example. By default your will get the cron job expression as your local timezone.
from datetime import datetime
from py_cron_expression.py_cron import CronJobExpression
cron_job = CronJobExpression()
timestamp = int(datetime.now().timestamp())
res = cron_job.cron_expression(time=timestamp, timezone='Asia/Dhaka')
print(res)
# Output
# 10 55 13 2 5 ? 2020
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
Built Distribution
File details
Details for the file PyCronExpression-0.0.3.tar.gz
.
File metadata
- Download URL: PyCronExpression-0.0.3.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eacedf3ba58ed5803e2f7fecddcb7d0909ee2d3a27a9dab133c76753bd5b50ae |
|
MD5 | fdcc2239d19ed24d82cbbe88aeed68c8 |
|
BLAKE2b-256 | d522cdb25d93c2cb467f13d610944fac3b82d41584ff4c525f49aeee5e8114db |
File details
Details for the file PyCronExpression-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: PyCronExpression-0.0.3-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8db5ef2963546c3dbf7cf8d165c97fdaa9b5893ab8d9a0f727c2d448894b201b |
|
MD5 | cd0fe7e232d0075a091921ecd9b63ef6 |
|
BLAKE2b-256 | 916453241edd9306653994f68815a29559b204b25c955cb2e41c460af3e6e3bf |