mirror of
https://github.com/andrewthetechie/py-healthchecks.io.git
synced 2025-12-05 17:18:16 +01:00
Compare commits
69 Commits
v0.4.2
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9e586702cc | ||
|
|
65b996e3f4 | ||
|
|
876741fe16 | ||
|
|
32c30445b9 | ||
|
|
282646e25b | ||
|
|
1aaa0549f2 | ||
|
|
9c2cde0159 | ||
|
|
7091a2a138 | ||
|
|
5108b4317f | ||
|
|
4f8bb6b9a4 | ||
|
|
10af98dcdd | ||
|
|
aadeceb327 | ||
|
|
37c780e865 | ||
|
|
e1a81aa145 | ||
|
|
305e72ead2 | ||
|
|
dd305ed93f | ||
|
|
c8aba10262 | ||
|
|
c4fa6e7ac3 | ||
|
|
7641446884 | ||
|
|
c4a73b1a57 | ||
|
|
5113322177 | ||
|
|
d9d67f2e0b | ||
|
|
e7756fbf28 | ||
|
|
4f0cd0b56e | ||
|
|
bf610095cb | ||
|
|
7a3c8d0a56 | ||
|
|
14fb13b075 | ||
|
|
b2448021be | ||
|
|
97b62b6005 | ||
|
|
86fd192f95 | ||
|
|
4de0f1ac2f | ||
|
|
02c3739c38 | ||
|
|
3ca1d33d7c | ||
|
|
ed43967801 | ||
|
|
08bf505f70 | ||
|
|
e88be9e88f | ||
|
|
95b93e857b | ||
|
|
483ad538bc | ||
|
|
90e150f049 | ||
|
|
f64e81fa0c | ||
|
|
277f7b5395 | ||
|
|
6262bf2a5a | ||
|
|
92b31dcb3d | ||
|
|
8e3d977abd | ||
|
|
af20f3bc11 | ||
|
|
3d49ae3b99 | ||
|
|
d065a29b66 | ||
|
|
aaad153b83 | ||
|
|
d9493ba25a | ||
|
|
cb9d03af5f | ||
|
|
a4b73966f1 | ||
|
|
e075a31fa3 | ||
|
|
c071ced5bf | ||
|
|
67ec0b5d58 | ||
|
|
6bae975521 | ||
|
|
f9e0fd0bd1 | ||
|
|
7fa3e2ff1a | ||
|
|
4d00499f94 | ||
|
|
5325352bae | ||
|
|
627f070e3f | ||
|
|
b372e66c44 | ||
|
|
55ea01de63 | ||
|
|
a78d6d9a85 | ||
|
|
0f52d6b535 | ||
|
|
e46f70c470 | ||
|
|
e24fcb233b | ||
|
|
afa83a2528 | ||
|
|
f615e35468 | ||
|
|
6e88834d93 |
6
.github/workflows/constraints.txt
vendored
6
.github/workflows/constraints.txt
vendored
@@ -1,6 +1,6 @@
|
|||||||
pip==24.0.0
|
pip==24.2
|
||||||
nox==2024.4.15
|
nox==2024.4.15
|
||||||
nox-poetry==1.0.3
|
nox-poetry==1.0.3
|
||||||
poetry==1.8.2
|
poetry==1.8.3
|
||||||
virtualenv==20.26.1
|
virtualenv==20.26.3
|
||||||
toml==0.10.2
|
toml==0.10.2
|
||||||
|
|||||||
4
.github/workflows/pre-release.yml
vendored
4
.github/workflows/pre-release.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
|||||||
fetch-depth: 2
|
fetch-depth: 2
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v5.1.0
|
uses: actions/setup-python@v5.2.0
|
||||||
with:
|
with:
|
||||||
python-version: "3.10"
|
python-version: "3.10"
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ jobs:
|
|||||||
poetry build --ansi
|
poetry build --ansi
|
||||||
|
|
||||||
- name: Publish package on TestPyPI
|
- name: Publish package on TestPyPI
|
||||||
uses: pypa/gh-action-pypi-publish@v1.8.14
|
uses: pypa/gh-action-pypi-publish@v1.10.0
|
||||||
with:
|
with:
|
||||||
user: __token__
|
user: __token__
|
||||||
password: ${{ secrets.TEST_PYPI_TOKEN }}
|
password: ${{ secrets.TEST_PYPI_TOKEN }}
|
||||||
|
|||||||
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -19,7 +19,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 2
|
fetch-depth: 2
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v5.1.0
|
uses: actions/setup-python@v5.2.0
|
||||||
with:
|
with:
|
||||||
python-version: "3.11"
|
python-version: "3.11"
|
||||||
- name: Install pip and poetry
|
- name: Install pip and poetry
|
||||||
|
|||||||
2
.github/workflows/tests.yml
vendored
2
.github/workflows/tests.yml
vendored
@@ -31,7 +31,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Python ${{ matrix.python }}
|
- name: Set up Python ${{ matrix.python }}
|
||||||
uses: actions/setup-python@v5.1.0
|
uses: actions/setup-python@v5.2.0
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python }}
|
python-version: ${{ matrix.python }}
|
||||||
|
|
||||||
|
|||||||
18
CHANGELOG.md
18
CHANGELOG.md
@@ -1,5 +1,23 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [0.4.3](https://github.com/andrewthetechie/py-healthchecks.io/compare/v0.4.2...v0.4.3) (2024-07-03)
|
||||||
|
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
|
||||||
|
* bump coverage from 7.5.1 to 7.5.2 ([#680](https://github.com/andrewthetechie/py-healthchecks.io/issues/680)) ([b372e66](https://github.com/andrewthetechie/py-healthchecks.io/commit/b372e66c44ae403af042a43b3d7de41142570eb3))
|
||||||
|
* bump coverage from 7.5.2 to 7.5.3 ([#683](https://github.com/andrewthetechie/py-healthchecks.io/issues/683)) ([5325352](https://github.com/andrewthetechie/py-healthchecks.io/commit/5325352bae60b332f4602e37adb3f35cc8ae11c7))
|
||||||
|
* bump httpx from 0.24.1 to 0.27.0 ([#668](https://github.com/andrewthetechie/py-healthchecks.io/issues/668)) ([6e88834](https://github.com/andrewthetechie/py-healthchecks.io/commit/6e88834d93ea28f9bfeb7b81bcac8227ee38580c))
|
||||||
|
* bump pre-commit from 2.21.0 to 3.5.0 ([#669](https://github.com/andrewthetechie/py-healthchecks.io/issues/669)) ([4d00499](https://github.com/andrewthetechie/py-healthchecks.io/commit/4d00499f94c7e6ad4af86742996fca9c266e8ddf))
|
||||||
|
* bump pytz from 2023.4 to 2024.1 ([#670](https://github.com/andrewthetechie/py-healthchecks.io/issues/670)) ([67ec0b5](https://github.com/andrewthetechie/py-healthchecks.io/commit/67ec0b5d58563c0fb92ee5a7754706b07d767c11))
|
||||||
|
* bump reorder-python-imports from 3.12.0 to 3.13.0 ([#685](https://github.com/andrewthetechie/py-healthchecks.io/issues/685)) ([c071ced](https://github.com/andrewthetechie/py-healthchecks.io/commit/c071ced5bfc00fcfef922d01a3c70961f03176d6))
|
||||||
|
* bump ruff from 0.4.3 to 0.4.4 ([#675](https://github.com/andrewthetechie/py-healthchecks.io/issues/675)) ([e46f70c](https://github.com/andrewthetechie/py-healthchecks.io/commit/e46f70c4708eb703c0f02a97efe62a94145f6e58))
|
||||||
|
* bump ruff from 0.4.4 to 0.4.5 ([#679](https://github.com/andrewthetechie/py-healthchecks.io/issues/679)) ([55ea01d](https://github.com/andrewthetechie/py-healthchecks.io/commit/55ea01de63c43865c0b41b4248f02d96b17f1c07))
|
||||||
|
* bump ruff from 0.4.5 to 0.4.6 ([#681](https://github.com/andrewthetechie/py-healthchecks.io/issues/681)) ([627f070](https://github.com/andrewthetechie/py-healthchecks.io/commit/627f070e3fcbaf53a523a5b81b0699e39ffc4229))
|
||||||
|
* bump ruff from 0.4.6 to 0.5.0 ([#699](https://github.com/andrewthetechie/py-healthchecks.io/issues/699)) ([f9e0fd0](https://github.com/andrewthetechie/py-healthchecks.io/commit/f9e0fd0bd135621f031ed5d490cfabdd90c8991d))
|
||||||
|
* bump the pip group with 3 updates ([#694](https://github.com/andrewthetechie/py-healthchecks.io/issues/694)) ([a4b7396](https://github.com/andrewthetechie/py-healthchecks.io/commit/a4b73966f1b44c609bd9bdd25505429bb8b772a8))
|
||||||
|
* bump types-pytz from 2023.4.0.20240130 to 2024.1.0.20240417 ([#672](https://github.com/andrewthetechie/py-healthchecks.io/issues/672)) ([e24fcb2](https://github.com/andrewthetechie/py-healthchecks.io/commit/e24fcb233bd7a35f3999e9fb7bd174ef357ecdcb))
|
||||||
|
|
||||||
## [0.4.2](https://github.com/andrewthetechie/py-healthchecks.io/compare/v0.4.1...v0.4.2) (2024-05-07)
|
## [0.4.2](https://github.com/andrewthetechie/py-healthchecks.io/compare/v0.4.1...v0.4.2) (2024-05-07)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
furo==2024.5.6
|
furo==2024.8.6
|
||||||
sphinx==7.3.7
|
sphinx==8.0.2
|
||||||
|
|||||||
@@ -121,7 +121,11 @@ def safety(session: Session) -> None:
|
|||||||
session.install("safety")
|
session.install("safety")
|
||||||
# ignore https://github.com/pytest-dev/py/issues/287
|
# ignore https://github.com/pytest-dev/py/issues/287
|
||||||
# its an irresposnbily filed CVE causing nose
|
# its an irresposnbily filed CVE causing nose
|
||||||
session.run("safety", "check", "--full-report", f"--file={requirements}", "--ignore=51457")
|
# ignore https://data.safetycli.com/v/70612/97c/
|
||||||
|
# Jinja2 vulnerability, maintainer believe it is not a valid vulnerability
|
||||||
|
# ignore https://data.safetycli.com/v/71064/97c/
|
||||||
|
# requests vulnerability. The fixed version is not compatible with the packaging library
|
||||||
|
session.run("safety", "check", "--full-report", f"--file={requirements}", "--ignore=51457,70612,71064")
|
||||||
|
|
||||||
|
|
||||||
@session(python=python_versions)
|
@session(python=python_versions)
|
||||||
|
|||||||
800
poetry.lock
generated
800
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "healthchecks_io"
|
name = "healthchecks_io"
|
||||||
version = "0.4.2"
|
version = "0.4.3"
|
||||||
description = "A python client package for Healthchecks.io API"
|
description = "A python client package for Healthchecks.io API"
|
||||||
authors = ["Andrew Herrington <andrew.the.techie@gmail.com>"]
|
authors = ["Andrew Herrington <andrew.the.techie@gmail.com>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
@@ -26,10 +26,11 @@ Changelog = "https://github.com/andrewthetechie/py-healthchecks.io/releases"
|
|||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = "^3.8"
|
python = "^3.8"
|
||||||
pydantic = "^1.9.1"
|
pydantic = ">=1.9.1,<3.0.0"
|
||||||
httpx = ">=0.23.0,<0.25.0"
|
httpx = ">=0.23.0,<0.28.0"
|
||||||
croniter = ">=1.1,<3.0"
|
croniter = ">=1.1,<4.0"
|
||||||
pytz = ">=2021.3,<2024.0"
|
pytz = ">=2024.1,<2025.0"
|
||||||
|
packaging = "^24.1"
|
||||||
|
|
||||||
[tool.poetry.group.dev.dependencies]
|
[tool.poetry.group.dev.dependencies]
|
||||||
pytest = "^7.2.1"
|
pytest = "^7.2.1"
|
||||||
@@ -39,20 +40,20 @@ mypy = "^1.0"
|
|||||||
xdoctest = {extras = ["colors"], version = "^1.1.1"}
|
xdoctest = {extras = ["colors"], version = "^1.1.1"}
|
||||||
sphinx = ">=4.3.2,<8.0.0"
|
sphinx = ">=4.3.2,<8.0.0"
|
||||||
sphinx-autobuild = ">=2021.3.14"
|
sphinx-autobuild = ">=2021.3.14"
|
||||||
pre-commit = "^2.21.0"
|
pre-commit = ">=2.21,<4.0"
|
||||||
reorder-python-imports = "^3.9.0"
|
reorder-python-imports = "^3.9.0"
|
||||||
pre-commit-hooks = "^4.4.0"
|
pre-commit-hooks = "^4.4.0"
|
||||||
pyupgrade = "^3.3.1"
|
pyupgrade = "^3.3.1"
|
||||||
furo = ">=2021.11.12"
|
furo = ">=2021.11.12"
|
||||||
pytest-cov = ">=4,<6"
|
pytest-cov = ">=4,<6"
|
||||||
types-croniter = ">=1.3.2,<3.0.0"
|
types-croniter = ">=1.3.2,<4.0.0"
|
||||||
types-pytz = ">=2022.7.1,<2024.0.0"
|
types-pytz = ">=2022.7.1,<2025.0.0"
|
||||||
pytest-asyncio = ">=0.20.3,<0.24.0"
|
pytest-asyncio = ">=0.20.3,<0.24.0"
|
||||||
respx = ">=0.20.1,<0.22.0"
|
respx = ">=0.20.1,<0.22.0"
|
||||||
pytest-mock = "^3.10.0"
|
pytest-mock = "^3.10.0"
|
||||||
pytest-lazy-fixture = "^0.6.3"
|
pytest-lazy-fixture = "^0.6.3"
|
||||||
pytest-xdist = "^3.2.0"
|
pytest-xdist = "^3.2.0"
|
||||||
ruff = ">=0.0.249,<0.4.4"
|
ruff = ">=0.5.1,<0.6.4"
|
||||||
bandit = "^1.7.4"
|
bandit = "^1.7.4"
|
||||||
|
|
||||||
[tool.coverage.paths]
|
[tool.coverage.paths]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"""Py Healthchecks.Io."""
|
"""Py Healthchecks.Io."""
|
||||||
|
|
||||||
# set by poetry-dynamic-versioning
|
# set by poetry-dynamic-versioning
|
||||||
__version__ = "0.4.2" # noqa: E402
|
__version__ = "0.4.3" # noqa: E402
|
||||||
|
|
||||||
from .client import AsyncClient # noqa: F401, E402
|
from .client import AsyncClient # noqa: F401, E402
|
||||||
from .client import Client # noqa: F401, E402
|
from .client import Client # noqa: F401, E402
|
||||||
|
|||||||
@@ -302,6 +302,7 @@ class Client(AbstractClient):
|
|||||||
|
|
||||||
svg, json, shields: reports two states: "up" and "down". It considers any checks in the grace period
|
svg, json, shields: reports two states: "up" and "down". It considers any checks in the grace period
|
||||||
as still "up".
|
as still "up".
|
||||||
|
|
||||||
svg3, json3, shields3: reports three states: "up", "late", and "down".
|
svg3, json3, shields3: reports three states: "up", "late", and "down".
|
||||||
|
|
||||||
The response includes a special * entry: this pseudo-tag reports the overal status
|
The response includes a special * entry: this pseudo-tag reports the overal status
|
||||||
|
|||||||
@@ -14,45 +14,45 @@ from urllib.parse import urlparse
|
|||||||
|
|
||||||
import pytz
|
import pytz
|
||||||
from croniter import croniter
|
from croniter import croniter
|
||||||
from pydantic import BaseModel
|
from pydantic import field_validator, BaseModel, ValidationInfo
|
||||||
from pydantic import Field
|
from pydantic import Field
|
||||||
from pydantic import validator
|
|
||||||
|
|
||||||
|
|
||||||
class Check(BaseModel):
|
class Check(BaseModel):
|
||||||
"""Schema for a check object, either from a readonly api request or a rw api request."""
|
"""Schema for a check object, either from a readonly api request or a rw api request."""
|
||||||
|
|
||||||
unique_key: Optional[str]
|
unique_key: Optional[str] = None
|
||||||
name: str
|
name: str
|
||||||
slug: str
|
slug: str
|
||||||
tags: Optional[str]
|
tags: Optional[str] = None
|
||||||
desc: Optional[str]
|
desc: Optional[str] = None
|
||||||
grace: int
|
grace: int
|
||||||
n_pings: int
|
n_pings: int
|
||||||
status: str
|
status: str
|
||||||
last_ping: Optional[datetime]
|
last_ping: Optional[datetime] = None
|
||||||
next_ping: Optional[datetime]
|
next_ping: Optional[datetime] = None
|
||||||
manual_resume: bool
|
manual_resume: bool
|
||||||
methods: Optional[str]
|
methods: Optional[str] = None
|
||||||
# healthchecks.io's api doesn't return a scheme so we cant use Pydantic AnyUrl here
|
# healthchecks.io's api doesn't return a scheme so we cant use Pydantic AnyUrl here
|
||||||
ping_url: Optional[str]
|
ping_url: Optional[str] = None
|
||||||
update_url: Optional[str]
|
update_url: Optional[str] = None
|
||||||
pause_url: Optional[str]
|
pause_url: Optional[str] = None
|
||||||
channels: Optional[str]
|
channels: Optional[str] = None
|
||||||
timeout: Optional[int]
|
timeout: Optional[int] = None
|
||||||
uuid: Optional[str]
|
uuid: Optional[str] = Field(default=None, validate_default=True)
|
||||||
|
|
||||||
@validator("uuid", always=True)
|
@field_validator("uuid")
|
||||||
def validate_uuid(cls, value: Optional[str], values: Dict[str, Any]) -> Optional[str]: # noqa: B902
|
@classmethod
|
||||||
|
def validate_uuid(cls, value: Optional[str], info: ValidationInfo) -> Optional[str]: # noqa: B902
|
||||||
"""Tries to set the uuid from the ping_url.
|
"""Tries to set the uuid from the ping_url.
|
||||||
|
|
||||||
Will return none if a read only token is used because it cannot retrieve the UUID of a check
|
Will return none if a read only token is used because it cannot retrieve the UUID of a check
|
||||||
"""
|
"""
|
||||||
if value is None and values.get("ping_url", None) is not None:
|
if value is None and info.data.get("ping_url", None) is not None:
|
||||||
# url is like healthchecks.io/ping/8f57b84b-86c2-4546-8923-03f83d27604a, so we want just the
|
# url is like healthchecks.io/ping/8f57b84b-86c2-4546-8923-03f83d27604a, so we want just the
|
||||||
# UUID off the end
|
# UUID off the end
|
||||||
# Parse the url, grab the path and then just get the name using pathlib
|
# Parse the url, grab the path and then just get the name using pathlib
|
||||||
path = PurePath(str(urlparse(values.get("ping_url")).path))
|
path = PurePath(str(urlparse(info.data.get("ping_url")).path))
|
||||||
return path.name
|
return path.name
|
||||||
return value
|
return value
|
||||||
|
|
||||||
@@ -126,28 +126,32 @@ class CheckCreate(BaseModel):
|
|||||||
"for the unique field are name, tags, timeout, and grace.",
|
"for the unique field are name, tags, timeout, and grace.",
|
||||||
)
|
)
|
||||||
|
|
||||||
@validator("schedule")
|
@field_validator("schedule")
|
||||||
|
@classmethod
|
||||||
def validate_schedule(cls, value: str) -> str:
|
def validate_schedule(cls, value: str) -> str:
|
||||||
"""Validates that the schedule is a valid cron expression."""
|
"""Validates that the schedule is a valid cron expression."""
|
||||||
if not croniter.is_valid(value):
|
if not croniter.is_valid(value):
|
||||||
raise ValueError("Schedule is not a valid cron expression")
|
raise ValueError("Schedule is not a valid cron expression")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
@validator("tz")
|
@field_validator("tz")
|
||||||
|
@classmethod
|
||||||
def validate_tz(cls, value: str) -> str:
|
def validate_tz(cls, value: str) -> str:
|
||||||
"""Validates that the timezone is a valid timezone string."""
|
"""Validates that the timezone is a valid timezone string."""
|
||||||
if value not in pytz.all_timezones:
|
if value not in pytz.all_timezones:
|
||||||
raise ValueError("Tz is not a valid timezone")
|
raise ValueError("Tz is not a valid timezone")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
@validator("methods")
|
@field_validator("methods")
|
||||||
|
@classmethod
|
||||||
def validate_methods(cls, value: str) -> str:
|
def validate_methods(cls, value: str) -> str:
|
||||||
"""Validate that methods."""
|
"""Validate that methods."""
|
||||||
if value not in ("", "POST"):
|
if value not in ("", "POST"):
|
||||||
raise ValueError("Methods is invalid, it should be either an empty string or POST")
|
raise ValueError("Methods is invalid, it should be either an empty string or POST")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
@validator("unique")
|
@field_validator("unique")
|
||||||
|
@classmethod
|
||||||
def validate_unique(cls, value: List[Optional[str]]) -> List[Optional[str]]:
|
def validate_unique(cls, value: List[Optional[str]]) -> List[Optional[str]]:
|
||||||
"""Validate unique list."""
|
"""Validate unique list."""
|
||||||
for unique in value:
|
for unique in value:
|
||||||
|
|||||||
Reference in New Issue
Block a user