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.0.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.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: orloj-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 f86c9818f1a2f08904a48df30bb6047940490f2c09ab4599d3824ac8c926aec9
MD5 b66882905e7b9cf0ee3137207c4d0f0a
BLAKE2b-256 0e35e72707d2d590e4f20cf26e3b0a2027a25bd93128905a839b88285e5edc3d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: orloj-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.2 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 61bee55f3776efc6a70a653c894148acbd262acbac2d5b8c33bf920e290c8ab0
MD5 d620a524a43dcc5c64994db378a1d480
BLAKE2b-256 12b9183e1b58defaca298697672cb335166abb915f5ee465d37317f61ca09b6f

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

0.1.1

2 files

This release

0.1.0 This release

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