feat: update dependencies and capture network errors when retrieving remote public keys
This commit is contained in:
parent
54a27a2f75
commit
812fee592e
4 changed files with 30 additions and 21 deletions
|
|
@ -1 +1 @@
|
||||||
__version__ = "0.4.5"
|
__version__ = "0.4.6"
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import yaml
|
||||||
from pydantic import DirectoryPath, Field, FilePath, HttpUrl, field_validator
|
from pydantic import DirectoryPath, Field, FilePath, HttpUrl, field_validator
|
||||||
from pydantic_core import Url
|
from pydantic_core import Url
|
||||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||||
|
from rich import print
|
||||||
|
|
||||||
|
|
||||||
class Settings(BaseSettings):
|
class Settings(BaseSettings):
|
||||||
|
|
@ -82,17 +83,25 @@ class Settings(BaseSettings):
|
||||||
keys = set()
|
keys = set()
|
||||||
for path in self.recipient_paths:
|
for path in self.recipient_paths:
|
||||||
if isinstance(path, Url):
|
if isinstance(path, Url):
|
||||||
with hishel.CacheClient(
|
try:
|
||||||
storage=hishel.FileStorage(base_path=self.cache_path / "hishel"),
|
with hishel.CacheClient(
|
||||||
) as client:
|
storage=hishel.FileStorage(
|
||||||
response = client.get(
|
base_path=self.cache_path / "hishel"
|
||||||
str(path),
|
),
|
||||||
timeout=self.remote_public_keys_timeout,
|
timeout=3,
|
||||||
|
) as client:
|
||||||
|
response = client.get(
|
||||||
|
str(path),
|
||||||
|
timeout=self.remote_public_keys_timeout,
|
||||||
|
)
|
||||||
|
if response.status_code == httpx.codes.OK:
|
||||||
|
for line in response.content.decode().split("\n"):
|
||||||
|
if line:
|
||||||
|
keys.add(line)
|
||||||
|
except Exception as e: # noqa: BLE001
|
||||||
|
print(
|
||||||
|
f"[yellow] Could not retrieve public key from {path}. Ignoring error: '{e}'"
|
||||||
)
|
)
|
||||||
if response.status_code == httpx.codes.OK:
|
|
||||||
for line in response.content.decode().split("\n"):
|
|
||||||
if line:
|
|
||||||
keys.add(line)
|
|
||||||
elif isinstance(path, Path):
|
elif isinstance(path, Path):
|
||||||
with path.open("r") as f:
|
with path.open("r") as f:
|
||||||
keys.add(f.read())
|
keys.add(f.read())
|
||||||
|
|
|
||||||
2
pdm.lock
generated
2
pdm.lock
generated
|
|
@ -5,7 +5,7 @@
|
||||||
groups = ["default", "docs", "linting", "testing", "dev"]
|
groups = ["default", "docs", "linting", "testing", "dev"]
|
||||||
strategy = ["cross_platform"]
|
strategy = ["cross_platform"]
|
||||||
lock_version = "4.4.1"
|
lock_version = "4.4.1"
|
||||||
content_hash = "sha256:7ac93593b9b93325db09d2e6d1121558b1f40de0891790971deae7531e2b5955"
|
content_hash = "sha256:386a15bb1ebd589f1aa4e7f9ebf6f5795e3219716277e28fdbd0a4c9a86465fa"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "annotated-types"
|
name = "annotated-types"
|
||||||
|
|
|
||||||
|
|
@ -4,16 +4,16 @@ authors = [
|
||||||
]
|
]
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"typer<1.0.0,>=0.6.1",
|
"typer>=0.12",
|
||||||
"rich>=13.3.3",
|
"rich>=13.3.3",
|
||||||
"pydantic>=2.0.3",
|
"pydantic>=2.7",
|
||||||
"pyyaml>=6.0",
|
"pyyaml>=6.0",
|
||||||
"pyrage>=1.1.1",
|
"pyrage>=1.1",
|
||||||
"pendulum>=2.1.2",
|
"pendulum>=3.0",
|
||||||
"httpx>=0.24.0",
|
"httpx>=0.27",
|
||||||
"platformdirs>=3.5.1",
|
"platformdirs>=4.2",
|
||||||
"pydantic-settings>=2.0.2",
|
"pydantic-settings>=2.0",
|
||||||
"hishel>=0.0.17",
|
"hishel>=0.0.26",
|
||||||
]
|
]
|
||||||
name = "halig"
|
name = "halig"
|
||||||
dynamic = ["version"]
|
dynamic = ["version"]
|
||||||
|
|
@ -90,7 +90,7 @@ reportAttributeAccessIssue = false
|
||||||
|
|
||||||
[tool.ruff.lint]
|
[tool.ruff.lint]
|
||||||
extend-select = ["W", "C90", "I", "N", "UP", "S", "BLE", "B", "A", "COM", "C4", "DTZ", "T10", "EM", "ISC", "T20", "PT", "RSE", "RET", "SIM", "PTH", "ERA", "PGH", "PL", "TRY", "RUF"]
|
extend-select = ["W", "C90", "I", "N", "UP", "S", "BLE", "B", "A", "COM", "C4", "DTZ", "T10", "EM", "ISC", "T20", "PT", "RSE", "RET", "SIM", "PTH", "ERA", "PGH", "PL", "TRY", "RUF"]
|
||||||
extend-ignore = ["S101", "ISC002"]
|
extend-ignore = ["S101", "ISC002", "COM812", "ISC001"]
|
||||||
|
|
||||||
[tool.mypy]
|
[tool.mypy]
|
||||||
python_version = "3.11"
|
python_version = "3.11"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue