How it works
The cron Library provides a simple and efficient way to automate tasks based on specified time intervals.
How to use
- Import the module to use the cron library
This can be done by using:
import cron
- Define a function
This can be done using:
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:
def Hello_Function():
print("Hello World")
- Define a function that will tell you when it runs, this will be told every
xseconds
This can be done using:
def time_alert_function(seconds):
print("I run every {0} seconds!".format(seconds))
- Create a function to run every
xamount of times
Make a first example function to run every 5 seconds
cron.addJob(example_function, 5)
Create a second example function to run every 1 second
cron.addJob(time_alert_function, 1, 1)
Currently the addJob parameters are; function, timeout/cron delay, args (only 1 supported currently)
- How to call your Cron jobs
You can use this function:
cron.start()
Option: pass True into the function call to make it non-thread blocking
Example:
cron.start(True)
Default is False or thread blocking.
This will start your timer fyunction, that will then execute your cron jobs.
- To prevent your program from ending whilst using
non-thread blocking mode
You can use:
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.
Metadata
Release files for rainydais-cron 1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rainydais-cron-1.2.tar.gz | 9.8 kB | Without provenance | Details for rainydais-cron-1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rainydais_cron-1.2-py3-none-any.whl | Python 3 | none | any | Details for rainydais_cron-1.2-py3-none-any.whl |
Total release size: 13.4 kB
Release files / rainydais-cron-1.2.tar.gz
| Download URL | rainydais-cron-1.2.tar.gz |
|---|---|
| Size | 9.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c12532d8b88f99afa9b6e3b2203d9988d20a804496423222bddc9f7909fdee2
|
|
BLAKE2b-256 checksum How to use checksums |
4ffd9680ca95b37ec0cbdde0629462acc24d390f62a3a88438427303677e7783
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.17
|
Release files / rainydais_cron-1.2-py3-none-any.whl
| Download URL | rainydais_cron-1.2-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
95e26c061402693020986303a2c3c8eee07c8fc08636914ab7d32c29c970de66
|
|
BLAKE2b-256 checksum How to use checksums |
456fe2a9bcb91e67b7454566ee13fb4fa55a36b04572831cf49298176f3607be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.17
|
Security for rainydais-cron 1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.