Skip to content

Latest commit

 

History

History
45 lines (34 loc) · 1003 Bytes

README.md

File metadata and controls

45 lines (34 loc) · 1003 Bytes

Heartbeat.sh Python Client

This is a Python client library for heartbeat.sh.

Quick start

Install with pip install heartbeat-sh requests

from datetime import timedelta
from heartbeat_sh import HeartbeatClient

HeartbeatClient("example").send_beat(
    "example:python",
    timedelta(days=1, hours=2),
    timedelta(days=2)
)

Use a custom requests library (Dependency Injection)

By default, this module uses the requests library to make HTTP requests. This is not a requirement. You may inject any request library:

from datetime import timedelta
from heartbeat_sh import HeartbeatClient

def request(url: str, method: str):
    return {
        "fake": "json result"
    }

HeartbeatClient(
    subdomain="example",
    request=request,
).send_beat(
    "example:python",
    timedelta(days=1, hours=2),
    timedelta(days=2)
)

Links