CronyxClient.py

API | Code of Conduct | Contributing | Changelog
A Python HTTP client wrapper for CronyxServer, seamlessly integrating the power of Cronyx across platforms using a familiar API interface.
🌟 Features
CronyxClient.py bridges the capabilities of Cronyx and CronyxServer, offering a way to schedule and manage tasks without losing the feel of the original Cronyx API.
Why CronyxClient.py?
🌐 Unified Experience: Retain the simplicity and power of the Cronyx API while benefiting from the language-agnostic capabilities of CronyxServer.
🔌 Plug & Play: With just a URL configuration, connect to any running instance of CronyxServer and harness its capabilities without changing your existing Cronyx codebase.
🚀 Familiar API with Async/Await: Use the same API calls you're familiar with from Cronyx, with the added advantage of Python's async and await syntax for handling asynchronous operations.
🚀 Getting Started
Installation
Install the CronyxClient.py package using pip:
$ pip install cronyx-client
# or
# $ poetry add cronyx-client
Basic Usage
1. Manually Handling Job Execution:
CronyxClient.py mirrors the usage of Cronyx, with the additional specification of the CronyxServer URL:
from cronyx_client import CronyxClient
cronyx = CronyxClient(url="http://localhost:3000/")
job = await cronyx.request_job_start(
job_name="hourly-job",
job_interval="0 * * * *",
)
# Check if the job is due to run
if job:
try:
print(job.interval_started_at)
print(job.interval_ended_at)
await job.finish()
except Exception as e:
await job.interrupt()
2. Using the Shorthand Callback:
from cronyx_client import CronyxClient
async def task(job):
print(job.interval_started_at)
print(job.interval_ended_at)
cronyx = CronyxClient(url="http://localhost:3000/")
await cronyx.request_job_exec(
job_name="hourly-job",
job_interval="0 * * * *",
task=task
)
Integrations and Compatibilities
CronyxClient.py is built on top of the Cronyx foundation, ensuring compatibility and integration with:
- Cronyx: Maintain the same API functions and structures, ensuring a seamless transition to CronyxClient.py.
- CronyxServer: Directly communicates with the server using its RESTful endpoints, translating your Cronyx API calls to HTTP requests.
💻 Development
Using Visual Studio Code and the Dev Containers extension, you can simplify the development environment setup process. The extension allows you to develop inside a Docker container and automatically sets up the development environment for you.
-
Install the Dev Containers extension in Visual Studio Code.
-
Clone the repository:
git clone https://github.com/yujiosaka/CronyxClient.py.git
-
Open the cloned repository in Visual Studio Code.
-
When prompted by Visual Studio Code, click "Reopen in Container" to open the project inside the Docker container.
-
The extension will build the Docker container and set up the development environment for you. This may take a few minutes.
-
Build and run the Docker container with Docker Compose:
$ docker-compose up --build
This will start testing in watch mode.
🧑💻️ API reference
See here for the API reference.
🐞 Debugging tips
Enable debug logging
Configure the log level using the LOG_LEVEL environment variable.
env LOG_LEVEL="DEBUG" python script.py
CronyxClient.py utilizes Python's logging module for logging debug messages. Ensure that you have the logger configured in your application to capture these logs.
💳 License
This project is licensed under the MIT License. See LICENSE for details.
Metadata
Release files for cronyx-client 1.0.0
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 |
|---|---|---|---|---|
| cronyx_client-1.0.0.tar.gz | 8.0 kB | Without provenance | Details for cronyx_client-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cronyx_client-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for cronyx_client-1.0.0-py3-none-any.whl |
Total release size: 16.7 kB
Release files / cronyx_client-1.0.0.tar.gz
| Download URL | cronyx_client-1.0.0.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
db7220e62e3edfdb62d766b780e112185d3c40a6f80ef7ce959f7053212923fe
|
|
BLAKE2b-256 checksum How to use checksums |
c5b6ba19e2b1e2eee447f3ff61ebe0bb76dc31e407148bfbdab4b7f089f0cce4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.0 CPython/3.11.6 Linux/6.2.0-1015-azure
|
Release files / cronyx_client-1.0.0-py3-none-any.whl
| Download URL | cronyx_client-1.0.0-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fedae2bc3a1bd72b177cc474a95060355387921035a73594f09207d3dfce57b3
|
|
BLAKE2b-256 checksum How to use checksums |
341b3205be7953f755bfaf58d904f4915b8c7ee19cdbf9404eda95e0ed774116
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.0 CPython/3.11.6 Linux/6.2.0-1015-azure
|
Security for cronyx-client 1.0.0
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.