diff --git a/CHANGELOG.md b/CHANGELOG.md index fc78ffd..3c51a85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,12 @@ and this project adheres to ### Changed - Updated l9format requirement from =1.3.2 to =1.4.0 ([ae676d9]) +- Updated l9format requirement from =1.4.0 to =2.0.0 ([df916e5], [#68]) + +### Removed + +- Removed dependency on serde (unmaintained), replaced with dataclasses + and l9format.l9format.Model ([df916e5], [#68]) ### Infrastructure @@ -54,6 +60,7 @@ and this project adheres to [0.1.9]: https://github.com/LeakIX/LeakIXClient-Python/releases/tag/v0.1.9 +[df916e5]: https://github.com/LeakIX/LeakIXClient-Python/commit/df916e5 [14bc55e]: https://github.com/LeakIX/LeakIXClient-Python/commit/14bc55e [a652654]: https://github.com/LeakIX/LeakIXClient-Python/commit/a652654 [3967e42]: https://github.com/LeakIX/LeakIXClient-Python/commit/3967e42 @@ -70,3 +77,4 @@ and this project adheres to [#66]: https://github.com/LeakIX/LeakIXClient-Python/pull/66 [#65]: https://github.com/LeakIX/LeakIXClient-Python/issues/65 [#67]: https://github.com/LeakIX/LeakIXClient-Python/issues/67 +[#68]: https://github.com/LeakIX/LeakIXClient-Python/pull/68 diff --git a/leakix/client.py b/leakix/client.py index dd4ead9..29353f7 100644 --- a/leakix/client.py +++ b/leakix/client.py @@ -1,3 +1,4 @@ +import dataclasses import json from enum import Enum from importlib.metadata import version @@ -5,7 +6,7 @@ import requests from l9format import l9format -from serde import Model, fields +from l9format.l9format import Model from leakix.domain import L9Subdomain from leakix.plugin import APIResult @@ -23,9 +24,10 @@ class Scope(Enum): LEAK = "leak" +@dataclasses.dataclass class HostResult(Model): - Services: fields.Optional(fields.List(fields.Nested(l9format.L9Event))) - Leaks: fields.Optional(fields.List(fields.Nested(l9format.L9Event))) + Services: list[l9format.L9Event] | None = None + Leaks: list[l9format.L9Event] | None = None DEFAULT_URL = "https://leakix.net" diff --git a/leakix/domain.py b/leakix/domain.py index d18ccc2..02360d2 100644 --- a/leakix/domain.py +++ b/leakix/domain.py @@ -1,7 +1,11 @@ -from serde import Model, fields +import dataclasses +from datetime import datetime +from l9format.l9format import Model + +@dataclasses.dataclass class L9Subdomain(Model): - subdomain: fields.Str() - distinct_ips: fields.Int() - last_seen: fields.DateTime() + subdomain: str = "" + distinct_ips: int = 0 + last_seen: datetime | None = None diff --git a/leakix/plugin.py b/leakix/plugin.py index da933f0..533f626 100644 --- a/leakix/plugin.py +++ b/leakix/plugin.py @@ -1,11 +1,13 @@ +import dataclasses from enum import Enum -from serde import Model, fields +from l9format.l9format import Model +@dataclasses.dataclass class APIResult(Model): - name: fields.Str() - description: fields.Str() + name: str = "" + description: str = "" class Plugin(Enum): diff --git a/pyproject.toml b/pyproject.toml index fc142e5..c70a12d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ authors = [{ name = "Danny Willems", email = "danny@leakix.net" }] requires-python = ">=3.13" dependencies = [ "requests", - "l9format==1.4.0", + "l9format==2.0.0", "fire>=0.5,<0.8", ]