Compare commits

...

23 Commits

Author SHA1 Message Date
Andrew
d065a29b66 chore(main): release 0.4.3 (#671) 2024-07-03 16:59:24 -05:00
dependabot[bot]
aaad153b83 ci: bump pip from 24.0.0 to 24.1.1 in /.github/workflows (#698) 2024-07-03 21:52:48 +00:00
dependabot[bot]
d9493ba25a ci: bump virtualenv from 20.26.2 to 20.26.3 in /.github/workflows (#697)
Bumps [virtualenv](https://github.com/pypa/virtualenv) from 20.26.2 to 20.26.3.
- [Release notes](https://github.com/pypa/virtualenv/releases)
- [Changelog](https://github.com/pypa/virtualenv/blob/main/docs/changelog.rst)
- [Commits](https://github.com/pypa/virtualenv/compare/20.26.2...20.26.3)

---
updated-dependencies:
- dependency-name: virtualenv
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-03 16:35:29 -05:00
dependabot[bot]
cb9d03af5f ci: bump pip from 24.0.0 to 24.1 in /.github/workflows (#695)
Bumps [pip](https://github.com/pypa/pip) from 24.0.0 to 24.1.
- [Changelog](https://github.com/pypa/pip/blob/main/NEWS.rst)
- [Commits](https://github.com/pypa/pip/compare/24.0...24.1)

---
updated-dependencies:
- dependency-name: pip
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-03 16:35:17 -05:00
dependabot[bot]
a4b73966f1 deps: bump the pip group with 3 updates (#694)
Bumps the pip group with 3 updates: [authlib](https://github.com/lepture/authlib), [tornado](https://github.com/tornadoweb/tornado) and [urllib3](https://github.com/urllib3/urllib3).


Updates `authlib` from 1.3.0 to 1.3.1
- [Release notes](https://github.com/lepture/authlib/releases)
- [Changelog](https://github.com/lepture/authlib/blob/master/docs/changelog.rst)
- [Commits](https://github.com/lepture/authlib/compare/v1.3.0...v1.3.1)

Updates `tornado` from 6.4 to 6.4.1
- [Changelog](https://github.com/tornadoweb/tornado/blob/master/docs/releases.rst)
- [Commits](https://github.com/tornadoweb/tornado/compare/v6.4.0...v6.4.1)

Updates `urllib3` from 2.2.1 to 2.2.2
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/2.2.1...2.2.2)

---
updated-dependencies:
- dependency-name: authlib
  dependency-type: indirect
  dependency-group: pip
- dependency-name: tornado
  dependency-type: indirect
  dependency-group: pip
- dependency-name: urllib3
  dependency-type: indirect
  dependency-group: pip
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-03 16:35:05 -05:00
dependabot[bot]
e075a31fa3 ci: bump pypa/gh-action-pypi-publish from 1.8.14 to 1.9.0 (#693)
Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.8.14 to 1.9.0.
- [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases)
- [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.8.14...v1.9.0)

---
updated-dependencies:
- dependency-name: pypa/gh-action-pypi-publish
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-03 16:34:43 -05:00
dependabot[bot]
c071ced5bf deps: bump reorder-python-imports from 3.12.0 to 3.13.0 (#685)
Bumps [reorder-python-imports](https://github.com/asottile/reorder-python-imports) from 3.12.0 to 3.13.0.
- [Commits](https://github.com/asottile/reorder-python-imports/compare/v3.12.0...v3.13.0)

---
updated-dependencies:
- dependency-name: reorder-python-imports
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-03 16:34:27 -05:00
dependabot[bot]
67ec0b5d58 deps: bump pytz from 2023.4 to 2024.1 (#670)
Bumps [pytz](https://github.com/stub42/pytz) from 2023.4 to 2024.1.
- [Release notes](https://github.com/stub42/pytz/releases)
- [Commits](https://github.com/stub42/pytz/compare/release_2023.4...release_2024.1)

---
updated-dependencies:
- dependency-name: pytz
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-03 16:34:01 -05:00
Andrew Herrington
6bae975521 chore: bump poetry lock 2024-07-03 16:30:12 -05:00
dependabot[bot]
f9e0fd0bd1 deps: bump ruff from 0.4.6 to 0.5.0 (#699)
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.4.6 to 0.5.0.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/v0.4.6...0.5.0)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-03 16:24:14 -05:00
Mariatta
7fa3e2ff1a Bump to pydantic 2.8.0 (#702)
* deps: bump pydantic from 1.10.15 to 2.8.0

Bumps [pydantic](https://github.com/pydantic/pydantic) from 1.10.15 to 2.8.0.
- [Release notes](https://github.com/pydantic/pydantic/releases)
- [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md)
- [Commits](https://github.com/pydantic/pydantic/compare/v1.10.15...v2.8.0)

---
updated-dependencies:
- dependency-name: pydantic
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update dependencies
run the bump-pydantic tool.

* Migrate the validate_uuid using field_validator.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-03 16:20:29 -05:00
dependabot[bot]
4d00499f94 deps: bump pre-commit from 2.21.0 to 3.5.0 (#669)
Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 2.21.0 to 3.5.0.
- [Release notes](https://github.com/pre-commit/pre-commit/releases)
- [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md)
- [Commits](https://github.com/pre-commit/pre-commit/compare/v2.21.0...v3.5.0)

---
updated-dependencies:
- dependency-name: pre-commit
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-01 13:09:15 -05:00
dependabot[bot]
5325352bae deps: bump coverage from 7.5.2 to 7.5.3 (#683) 2024-05-30 01:08:58 +00:00
dependabot[bot]
627f070e3f deps: bump ruff from 0.4.5 to 0.4.6 (#681) 2024-05-29 01:13:59 +00:00
dependabot[bot]
b372e66c44 deps: bump coverage from 7.5.1 to 7.5.2 (#680) 2024-05-27 01:45:29 +00:00
dependabot[bot]
55ea01de63 deps: bump ruff from 0.4.4 to 0.4.5 (#679) 2024-05-24 02:03:57 +00:00
dependabot[bot]
a78d6d9a85 --- (#678) 2024-05-21 01:19:49 +00:00
dependabot[bot]
0f52d6b535 --- (#677) 2024-05-21 01:17:01 +00:00
dependabot[bot]
e46f70c470 deps: bump ruff from 0.4.3 to 0.4.4 (#675) 2024-05-20 01:10:51 +00:00
dependabot[bot]
e24fcb233b deps: bump types-pytz from 2023.4.0.20240130 to 2024.1.0.20240417 (#672)
Bumps [types-pytz](https://github.com/python/typeshed) from 2023.4.0.20240130 to 2024.1.0.20240417.
- [Commits](https://github.com/python/typeshed/commits)

---
updated-dependencies:
- dependency-name: types-pytz
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-18 11:18:19 -05:00
dependabot[bot]
afa83a2528 ci: bump virtualenv from 20.26.1 to 20.26.2 in /.github/workflows (#674) 2024-05-14 01:22:03 +00:00
dependabot[bot]
f615e35468 ci: bump poetry from 1.8.2 to 1.8.3 in /.github/workflows (#673) 2024-05-09 01:57:19 +00:00
dependabot[bot]
6e88834d93 deps: bump httpx from 0.24.1 to 0.27.0 (#668) 2024-05-08 01:36:31 +00:00
9 changed files with 439 additions and 347 deletions

View File

@@ -1,6 +1,6 @@
pip==24.0.0
pip==24.1.1
nox==2024.4.15
nox-poetry==1.0.3
poetry==1.8.2
virtualenv==20.26.1
poetry==1.8.3
virtualenv==20.26.3
toml==0.10.2

View File

@@ -34,7 +34,7 @@ jobs:
poetry build --ansi
- name: Publish package on TestPyPI
uses: pypa/gh-action-pypi-publish@v1.8.14
uses: pypa/gh-action-pypi-publish@v1.9.0
with:
user: __token__
password: ${{ secrets.TEST_PYPI_TOKEN }}

View File

@@ -1,5 +1,23 @@
# 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)

View File

@@ -121,7 +121,11 @@ def safety(session: Session) -> None:
session.install("safety")
# ignore https://github.com/pytest-dev/py/issues/287
# 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)

688
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
[tool.poetry]
name = "healthchecks_io"
version = "0.4.2"
version = "0.4.3"
description = "A python client package for Healthchecks.io API"
authors = ["Andrew Herrington <andrew.the.techie@gmail.com>"]
license = "MIT"
@@ -26,10 +26,11 @@ Changelog = "https://github.com/andrewthetechie/py-healthchecks.io/releases"
[tool.poetry.dependencies]
python = "^3.8"
pydantic = "^1.9.1"
httpx = ">=0.23.0,<0.25.0"
pydantic = ">=1.9.1,<3.0.0"
httpx = ">=0.23.0,<0.28.0"
croniter = ">=1.1,<3.0"
pytz = ">=2021.3,<2024.0"
pytz = ">=2024.1,<2025.0"
packaging = "^24.1"
[tool.poetry.group.dev.dependencies]
pytest = "^7.2.1"
@@ -39,20 +40,20 @@ mypy = "^1.0"
xdoctest = {extras = ["colors"], version = "^1.1.1"}
sphinx = ">=4.3.2,<8.0.0"
sphinx-autobuild = ">=2021.3.14"
pre-commit = "^2.21.0"
pre-commit = ">=2.21,<4.0"
reorder-python-imports = "^3.9.0"
pre-commit-hooks = "^4.4.0"
pyupgrade = "^3.3.1"
furo = ">=2021.11.12"
pytest-cov = ">=4,<6"
types-croniter = ">=1.3.2,<3.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"
respx = ">=0.20.1,<0.22.0"
pytest-mock = "^3.10.0"
pytest-lazy-fixture = "^0.6.3"
pytest-xdist = "^3.2.0"
ruff = ">=0.0.249,<0.4.4"
ruff = ">=0.5.0,<0.5.1"
bandit = "^1.7.4"
[tool.coverage.paths]

View File

@@ -1,7 +1,7 @@
"""Py Healthchecks.Io."""
# 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 Client # noqa: F401, E402

View File

@@ -302,6 +302,7 @@ class Client(AbstractClient):
svg, json, shields: reports two states: "up" and "down". It considers any checks in the grace period
as still "up".
svg3, json3, shields3: reports three states: "up", "late", and "down".
The response includes a special * entry: this pseudo-tag reports the overal status

View File

@@ -14,45 +14,45 @@ from urllib.parse import urlparse
import pytz
from croniter import croniter
from pydantic import BaseModel
from pydantic import field_validator, BaseModel, ValidationInfo
from pydantic import Field
from pydantic import validator
class Check(BaseModel):
"""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
slug: str
tags: Optional[str]
desc: Optional[str]
tags: Optional[str] = None
desc: Optional[str] = None
grace: int
n_pings: int
status: str
last_ping: Optional[datetime]
next_ping: Optional[datetime]
last_ping: Optional[datetime] = None
next_ping: Optional[datetime] = None
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
ping_url: Optional[str]
update_url: Optional[str]
pause_url: Optional[str]
channels: Optional[str]
timeout: Optional[int]
uuid: Optional[str]
ping_url: Optional[str] = None
update_url: Optional[str] = None
pause_url: Optional[str] = None
channels: Optional[str] = None
timeout: Optional[int] = None
uuid: Optional[str] = Field(default=None, validate_default=True)
@validator("uuid", always=True)
def validate_uuid(cls, value: Optional[str], values: Dict[str, Any]) -> Optional[str]: # noqa: B902
@field_validator("uuid")
@classmethod
def validate_uuid(cls, value: Optional[str], info: ValidationInfo) -> Optional[str]: # noqa: B902
"""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
"""
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
# UUID off the end
# 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 value
@@ -126,28 +126,32 @@ class CheckCreate(BaseModel):
"for the unique field are name, tags, timeout, and grace.",
)
@validator("schedule")
@field_validator("schedule")
@classmethod
def validate_schedule(cls, value: str) -> str:
"""Validates that the schedule is a valid cron expression."""
if not croniter.is_valid(value):
raise ValueError("Schedule is not a valid cron expression")
return value
@validator("tz")
@field_validator("tz")
@classmethod
def validate_tz(cls, value: str) -> str:
"""Validates that the timezone is a valid timezone string."""
if value not in pytz.all_timezones:
raise ValueError("Tz is not a valid timezone")
return value
@validator("methods")
@field_validator("methods")
@classmethod
def validate_methods(cls, value: str) -> str:
"""Validate that methods."""
if value not in ("", "POST"):
raise ValueError("Methods is invalid, it should be either an empty string or POST")
return value
@validator("unique")
@field_validator("unique")
@classmethod
def validate_unique(cls, value: List[Optional[str]]) -> List[Optional[str]]:
"""Validate unique list."""
for unique in value: