Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
run: make check-format
- name: Run linter
run: make lint
- name: Type check
run: make typecheck
- name: Security audit
run: make audit

Expand All @@ -49,5 +51,7 @@ jobs:
run: make check-format
- name: Run linter
run: make lint
- name: Type check
run: make typecheck
- name: Security audit
run: make audit
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ and this project adheres to
- CI: use Makefile targets in Windows job and add sequential per-commit
testing triggered by the ci:per-commit label ([3967e42], [#66])
- Remove duplicated lint-shell target in Makefile ([a652654], [#67])
- Add mypy type checking to CI workflow ([6b9a3db], [#42])
- Migrate from Poetry to uv ([14bc55e], [#65])

## [0.1.10] - 2024-12-XX
Expand Down Expand Up @@ -64,6 +65,7 @@ and this project adheres to
[0.1.9]: https://github.com/LeakIX/LeakIXClient-Python/releases/tag/v0.1.9

<!-- Commit links -->
[6b9a3db]: https://github.com/LeakIX/LeakIXClient-Python/commit/6b9a3db
[d111628]: https://github.com/LeakIX/LeakIXClient-Python/commit/d111628
[df916e5]: https://github.com/LeakIX/LeakIXClient-Python/commit/df916e5
[14bc55e]: https://github.com/LeakIX/LeakIXClient-Python/commit/14bc55e
Expand All @@ -82,4 +84,5 @@ 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
[#42]: https://github.com/LeakIX/LeakIXClient-Python/issues/42
[#68]: https://github.com/LeakIX/LeakIXClient-Python/pull/68
16 changes: 5 additions & 11 deletions leakix/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import json
from enum import Enum
from importlib.metadata import version
from typing import Any
from typing import Any, cast

import requests
from l9format import l9format
Expand Down Expand Up @@ -99,9 +99,7 @@ def get(
if queries is None or len(queries) == 0:
serialized_query = EmptyQuery().serialize()
else:
serialized_query = [q.serialize() for q in queries]
serialized_query = " ".join(serialized_query)
serialized_query = f"{serialized_query}"
serialized_query = " ".join(q.serialize() for q in queries)
url = f"{self.base_url}/search"
r = self.__get(
url=url,
Expand Down Expand Up @@ -149,7 +147,7 @@ def get_host(self, ipv4: str) -> AbstractResponse:
r = self.__get(url, params=None)
if r.is_success():
response_json = r.json()
formatted_result = HostResult.from_dict(response_json)
formatted_result = cast(HostResult, HostResult.from_dict(response_json))
response_json = {
"services": formatted_result.Services,
"leaks": formatted_result.Leaks,
Expand Down Expand Up @@ -190,9 +188,7 @@ def bulk_export(self, queries: list[Query] | None = None) -> AbstractResponse:
if queries is None or len(queries) == 0:
serialized_query = EmptyQuery().serialize()
else:
serialized_query = [q.serialize() for q in queries]
serialized_query = " ".join(serialized_query)
serialized_query = f"{serialized_query}"
serialized_query = " ".join(q.serialize() for q in queries)
params = {"q": serialized_query}
r = requests.get(url, params=params, headers=self.headers, stream=True)
if r.status_code == 200:
Expand Down Expand Up @@ -228,9 +224,7 @@ def bulk_service(self, queries: list[Query] | None = None) -> AbstractResponse:
if queries is None or len(queries) == 0:
serialized_query = EmptyQuery().serialize()
else:
serialized_query = [q.serialize() for q in queries]
serialized_query = " ".join(serialized_query)
serialized_query = f"{serialized_query}"
serialized_query = " ".join(q.serialize() for q in queries)
params = {"q": serialized_query}
r = requests.get(url, params=params, headers=self.headers, stream=True)
if r.status_code == 200:
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dev = [
"pytest",
"pytest-cov",
"mypy",
"types-requests",
"requests-mock",
"ruff",
"pip-audit",
Expand Down
Loading