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
2 changes: 1 addition & 1 deletion logsight/enterprise.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,6 @@ def send(self, payload: dict[str, Any]) -> bool:
)
try:
with urllib.request.urlopen(request, timeout=self.timeout) as response: # nosec B310
return 200 <= response.status < 300
return bool(200 <= response.status < 300)
except (OSError, ValueError):
return False
6 changes: 3 additions & 3 deletions logsight/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import json
import urllib.parse
import urllib.request
from typing import Any
from typing import Any, cast


class ClickHouseStore:
Expand All @@ -26,7 +26,7 @@ def execute(self, query: str, data: str | None = None) -> bytes:
method="POST",
)
with urllib.request.urlopen(request, timeout=10) as response: # nosec B310
return response.read()
return cast(bytes, response.read())

def insert_events(self, events: list[dict[str, Any]]) -> None:
if not events:
Expand All @@ -52,4 +52,4 @@ def upsert(self, points: list[dict[str, Any]]) -> dict[str, Any]:
method="PUT",
)
with urllib.request.urlopen(request, timeout=10) as response: # nosec B310
return json.loads(response.read().decode())
return cast(dict[str, Any], json.loads(response.read().decode()))
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ strict = true
packages = ["logsight"]
follow_imports = "skip"
disallow_untyped_decorators = false
ignore_missing_imports = true
warn_unused_ignores = false

[tool.bandit]
exclude_dirs = ["tests", "work"]