Skip to main content

Orloj

Format Python version License Top Languages Size Last commit

Orloj banner

Getting Started

The following example shows you how to setup OrlojMiddleware to run scheduled tasks alongside your FastAPI application.

from fastapi import FastAPI
from logging import Logger, getLogger
from orloj import OrlojMiddleware
from starlette.responses import PlainTextResponse, RedirectResponse

app = FastAPI()
logger: Logger = getLogger("uvicorn")

def hello_name(name: str) -> None:
  logger.info(f"Hello, {name}!")

def hello_world() -> None:
  logger.info("Hello, World!")

@app.get("/")
async def redirect_to_swagger_docs() -> RedirectResponse:
  """Redirects to swagger documentation
  """
  return RedirectResponse("/docs")

@app.get("/health", response_class=PlainTextResponse, status_code=200)
async def health() -> str:
  """Health check
  """
  return "OK"

app.add_middleware(OrlojMiddleware, interval=3, job=hello_name, name="Igor")
app.add_middleware(OrlojMiddleware, interval=6, job=hello_world)

Contributions

To contribute to the project, fork the repository and clone to your local device and development dependencies including three extra libraries not included in final builds as such:

  • black - The uncompromising Python code formatter
  • mypy - Optional static typing for Python
  • pytest - The pytest framework makes it easy to write small tests, yet scales to support complex functional testing

Use the following commands to setup your local environment with development dependencies:

pip install --user poetry
poetry install --with dev

Acknowledgements

License

This project is licensed under the terms of the MIT license.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

orloj-0.1.1.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

orloj-0.1.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file orloj-0.1.1.tar.gz.

File metadata

  • Download URL: orloj-0.1.1.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.13 Darwin/22.1.0

File hashes

Hashes for orloj-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8b412fac1b727519ff52c4e76bccfe6dc61d2b7b09816a6f4e192cc6e623ec28
MD5 53c71e2d8658c4d643ae43298ccae81e
BLAKE2b-256 ea728c5168c18f68321e46092367b80efc0f31b31e87bea049ece6943585e200

See more details on using hashes here.

File details

Details for the file orloj-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: orloj-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.13 Darwin/22.1.0

File hashes

Hashes for orloj-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3efe9d26ee51f1a393be0ed0eb6fb8d8087678cabc6ae63fbfea20ce2651e758
MD5 c888b83394ba89e67b35335525ca5cfe
BLAKE2b-256 a3ee635c14092ba32c421e77c5d018cd8f96edec7c2ee11b1ed2e512fda35ae9

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

This release

0.1.1 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page