Scheduler program
Project description
# calendar_scheduler
Google like calendar scheduler. Finding eta with given parameters is bit of challenging. I found a pattern here and made it as a package.
# Installation
pip3 install calendar_scheduler
# Usage
There are two types of schedulers that you can use of.<br>
### 1. Date Specific<br >
You can specify single or multiple dates to get the eta referenced to current datetime
from scheduler import Scheduler
scheduler = Scheduler()
payload = {
"schedule_type": "date_specific",
"timezone": "<valid_timezone>",
"schedules": [
{
"start_date": "<mm/dd/yyyy>*",
"start_time": "<HH:MM AM/PM>*"
}
]
}
eta = scheduler.get_next_eta(schedule_data=payload)
# This will return UTC converted eta (datetime obj)
# You can specify multiple dates
### 2. Recurring using `cron`
You can specify a cron to get next eta with respect to current datetime and also you can specify the base datetime.
from scheduler import Scheduler
scheduler = Scheduler()
payload = {
"schedule_type": "cron",
"timezone": "<valid_timezone>",
"start_date": "<mm/dd/yyyy>*",
"start_time": "<HH:MM AM/PM>*",
"end_date": "[<mm/dd/yyyy>]",
"end_time": "[<HH:MM AM/PM>]",
"cron": "<cron expression>"
}
eta = scheduler.get_next_eta(schedule_data=payload)
# This will return UTC converted eta (datetime obj)
# Unit Tests
python3 -m unittest discover scheduler.tests
# Coverage
coverage run -m unittest discover scheduler.tests
coverage report
# Cron generator
https://www.npmjs.com/package/cron-builder
# Thanks
https://github.com/kiorky/croniter
# How to contribute
- Submit a PR, welcome for feedback
Note: I've been using package from so long and it is in production.
# Author
Partha saradhi Konda <parthasaradhi1992@gmail.com>
Google like calendar scheduler. Finding eta with given parameters is bit of challenging. I found a pattern here and made it as a package.
# Installation
pip3 install calendar_scheduler
# Usage
There are two types of schedulers that you can use of.<br>
### 1. Date Specific<br >
You can specify single or multiple dates to get the eta referenced to current datetime
from scheduler import Scheduler
scheduler = Scheduler()
payload = {
"schedule_type": "date_specific",
"timezone": "<valid_timezone>",
"schedules": [
{
"start_date": "<mm/dd/yyyy>*",
"start_time": "<HH:MM AM/PM>*"
}
]
}
eta = scheduler.get_next_eta(schedule_data=payload)
# This will return UTC converted eta (datetime obj)
# You can specify multiple dates
### 2. Recurring using `cron`
You can specify a cron to get next eta with respect to current datetime and also you can specify the base datetime.
from scheduler import Scheduler
scheduler = Scheduler()
payload = {
"schedule_type": "cron",
"timezone": "<valid_timezone>",
"start_date": "<mm/dd/yyyy>*",
"start_time": "<HH:MM AM/PM>*",
"end_date": "[<mm/dd/yyyy>]",
"end_time": "[<HH:MM AM/PM>]",
"cron": "<cron expression>"
}
eta = scheduler.get_next_eta(schedule_data=payload)
# This will return UTC converted eta (datetime obj)
# Unit Tests
python3 -m unittest discover scheduler.tests
# Coverage
coverage run -m unittest discover scheduler.tests
coverage report
# Cron generator
https://www.npmjs.com/package/cron-builder
# Thanks
https://github.com/kiorky/croniter
# How to contribute
- Submit a PR, welcome for feedback
Note: I've been using package from so long and it is in production.
# Author
Partha saradhi Konda <parthasaradhi1992@gmail.com>
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
File details
Details for the file calendar_scheduler-0.0.2.tar.gz
.
File metadata
- Download URL: calendar_scheduler-0.0.2.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 922d8b9cfef3476c8de81af331b364bee0ccb4b565bc3950c81ef892c65da4ca |
|
MD5 | 35a21fe91b4c4cdeed3c862424de87ec |
|
BLAKE2b-256 | 703ee117aa20b8f7ceac7612177780b0e5a7807936bdf64f956636c6a8688594 |