Name | rainydais-cron JSON |
Version |
1.2
JSON |
| download |
home_page | |
Summary | A lightweight Python library to simplify cron job management. |
upload_time | 2023-06-23 17:50:12 |
maintainer | |
docs_url | None |
author | kgsensei |
requires_python | >=3.2 |
license | MIT |
keywords |
cron
cron job
rainydais
kgsensei
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
<div align="center">
# Cron Library
------ A libary by RainyDais ------
</div>
<div align="center">
<img src="docs/div.png" alt="divider"/>
</div>
<div align="center">
# How it works
The cron Library provides a simple and efficient way to automate tasks based on specified time intervals.
# How to use
</div>
<div align="left">
<div align="center">
<img src="docs/1.png" alt="divider"/>
</div>
* Import the module to use the cron library
This can be done by using:
```python
import cron
```
<div align="center">
<img src="docs/2.png" alt="divider"/>
</div>
* Define a function
This can be done using:
```python
def your_function():
print("your_text")
```
The `def your_function():` is what you use to make a function, this function will say `your_text`.
Example:
```python
def Hello_Function():
print("Hello World")
```
<div align="center">
<img src="docs/3.png" alt="divider"/>
</div>
* Define a function that will tell you when it runs, this will be told every `x` seconds
This can be done using:
```python
def time_alert_function(seconds):
print("I run every {0} seconds!".format(seconds))
```
<div align="center">
<img src="docs/4.png" alt="divider"/>
</div>
* Create a function to run every `x` amount of times
Make a first example function to run every 5 seconds
```python
cron.addJob(example_function, 5)
```
Create a second example function to run every 1 second
```python
cron.addJob(time_alert_function, 1, 1)
```
Currently the `addJob` parameters are; `function, timeout/cron delay, args` (only 1 supported currently)
<div align="center">
<img src="docs/5.png" alt="divider"/>
</div>
* How to call your Cron jobs
You can use this function:
```python
cron.start()
```
Option: pass `True` into the function call to make it non-thread blocking
Example:
```python
cron.start(True)
```
Default is False or thread blocking.
This will start your timer fyunction, that will then execute your cron jobs.
<div align="center">
<img src="docs/6.png" alt="divider"/>
</div>
* To prevent your program from ending whilst using `non-thread blocking mode`
You can use:
```python
input("\n Hello, this is the end of the file!\n\n")
```
This will also act as a test to prove `cron.start()` isn't blocking the thread
It contains newline characters so it doesn't get put on the same line as
other print messages that will come in from the threaded cron jobs.
</div>
Raw data
{
"_id": null,
"home_page": "",
"name": "rainydais-cron",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.2",
"maintainer_email": "",
"keywords": "cron,cron job,RainyDais,kgsensei",
"author": "kgsensei",
"author_email": "RainyDais <support@rainydais.com>",
"download_url": "https://files.pythonhosted.org/packages/4f/fd/9680ca95b37ec0cbdde0629462acc24d390f62a3a88438427303677e7783/rainydais-cron-1.2.tar.gz",
"platform": null,
"description": "<div align=\"center\">\n\n# Cron Library\n\n------ A libary by RainyDais ------\n\n</div>\n\n<div align=\"center\">\n <img src=\"docs/div.png\" alt=\"divider\"/>\n</div>\n\n<div align=\"center\">\n \n# How it works\n\nThe cron Library provides a simple and efficient way to automate tasks based on specified time intervals.\n\n# How to use\n\n</div>\n\n<div align=\"left\">\n<div align=\"center\">\n <img src=\"docs/1.png\" alt=\"divider\"/>\n</div>\n\n* Import the module to use the cron library\n\nThis can be done by using:\n\n```python\nimport cron\n```\n\n<div align=\"center\">\n <img src=\"docs/2.png\" alt=\"divider\"/>\n</div>\n\n* Define a function\n\nThis can be done using:\n\n```python\ndef your_function():\n print(\"your_text\")\n```\n\nThe `def your_function():` is what you use to make a function, this function will say `your_text`.\n\nExample:\n\n```python\ndef Hello_Function():\n print(\"Hello World\")\n```\n\n<div align=\"center\">\n <img src=\"docs/3.png\" alt=\"divider\"/>\n</div>\n\n* Define a function that will tell you when it runs, this will be told every `x` seconds\n\nThis can be done using:\n\n```python\ndef time_alert_function(seconds):\n print(\"I run every {0} seconds!\".format(seconds))\n```\n\n\n<div align=\"center\">\n <img src=\"docs/4.png\" alt=\"divider\"/>\n</div>\n\n* Create a function to run every `x` amount of times \n\nMake a first example function to run every 5 seconds\n\n```python\ncron.addJob(example_function, 5)\n```\n\nCreate a second example function to run every 1 second\n\n```python\ncron.addJob(time_alert_function, 1, 1)\n```\n\nCurrently the `addJob` parameters are; `function, timeout/cron delay, args` (only 1 supported currently)\n\n<div align=\"center\">\n <img src=\"docs/5.png\" alt=\"divider\"/>\n</div>\n\n* How to call your Cron jobs\n\nYou can use this function:\n\n```python\ncron.start()\n```\n\nOption: pass `True` into the function call to make it non-thread blocking\n\nExample:\n\n```python\ncron.start(True)\n```\nDefault is False or thread blocking.\n\nThis will start your timer fyunction, that will then execute your cron jobs.\n\n<div align=\"center\">\n <img src=\"docs/6.png\" alt=\"divider\"/>\n</div> \n\n* To prevent your program from ending whilst using `non-thread blocking mode`\n\nYou can use:\n\n```python\ninput(\"\\n Hello, this is the end of the file!\\n\\n\")\n```\n\nThis will also act as a test to prove `cron.start()` isn't blocking the thread\nIt contains newline characters so it doesn't get put on the same line as\nother print messages that will come in from the threaded cron jobs.\n</div>\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A lightweight Python library to simplify cron job management.",
"version": "1.2",
"project_urls": {
"Homepage": "https://rainydais.com",
"Repository": "https://github.com/RainyDais/cron.git"
},
"split_keywords": [
"cron",
"cron job",
"rainydais",
"kgsensei"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "456fe2a9bcb91e67b7454566ee13fb4fa55a36b04572831cf49298176f3607be",
"md5": "8378b9015cf142cdec23c7c4975f260e",
"sha256": "95e26c061402693020986303a2c3c8eee07c8fc08636914ab7d32c29c970de66"
},
"downloads": -1,
"filename": "rainydais_cron-1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8378b9015cf142cdec23c7c4975f260e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.2",
"size": 3604,
"upload_time": "2023-06-23T17:50:08",
"upload_time_iso_8601": "2023-06-23T17:50:08.955005Z",
"url": "https://files.pythonhosted.org/packages/45/6f/e2a9bcb91e67b7454566ee13fb4fa55a36b04572831cf49298176f3607be/rainydais_cron-1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4ffd9680ca95b37ec0cbdde0629462acc24d390f62a3a88438427303677e7783",
"md5": "8cd9a7dc25bf0ae84c8c8503543d3813",
"sha256": "2c12532d8b88f99afa9b6e3b2203d9988d20a804496423222bddc9f7909fdee2"
},
"downloads": -1,
"filename": "rainydais-cron-1.2.tar.gz",
"has_sig": false,
"md5_digest": "8cd9a7dc25bf0ae84c8c8503543d3813",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.2",
"size": 9778,
"upload_time": "2023-06-23T17:50:12",
"upload_time_iso_8601": "2023-06-23T17:50:12.667141Z",
"url": "https://files.pythonhosted.org/packages/4f/fd/9680ca95b37ec0cbdde0629462acc24d390f62a3a88438427303677e7783/rainydais-cron-1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-23 17:50:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "RainyDais",
"github_project": "cron",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "rainydais-cron"
}