Run autoformat, Add readme
This commit is contained in:
parent
d1b8839dba
commit
f973938f53
@ -34,7 +34,9 @@ class Pass:
|
||||
summary += " [!]"
|
||||
|
||||
description = []
|
||||
description.append(f"Azimuth: {self.start_az} ({self.start_compass}) to {self.end_az} ({self.end_compass})")
|
||||
description.append(
|
||||
f"Azimuth: {self.start_az} ({self.start_compass}) to {self.end_az} ({self.end_compass})"
|
||||
)
|
||||
description.append("")
|
||||
description.append("Downlinks:")
|
||||
for downlink in self.downlinks:
|
||||
|
@ -86,10 +86,11 @@ class N2YO:
|
||||
|
||||
return RadioPasses.parse_obj(response)
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
async def n2yo_api(key: str):
|
||||
api = N2YO(key)
|
||||
try:
|
||||
yield api
|
||||
finally:
|
||||
await api.client.close()
|
||||
await api.client.close()
|
||||
|
@ -4,10 +4,12 @@ from pydantic import BaseModel
|
||||
|
||||
from .settings import settings
|
||||
|
||||
|
||||
class Downlink(BaseModel):
|
||||
proto: str
|
||||
freq: float
|
||||
|
||||
|
||||
class Satellite(BaseModel):
|
||||
name: str
|
||||
downlink: list[Downlink]
|
||||
@ -17,7 +19,4 @@ def read_satellites() -> dict[int, Satellite]:
|
||||
with open(settings.satellites_file, "rb") as f:
|
||||
data = tomllib.load(f)
|
||||
|
||||
return {
|
||||
int(k): Satellite.parse_obj(v)
|
||||
for k, v in data.items()
|
||||
}
|
||||
return {int(k): Satellite.parse_obj(v) for k, v in data.items()}
|
||||
|
@ -1,5 +1,6 @@
|
||||
from pydantic import BaseSettings, BaseModel
|
||||
|
||||
|
||||
class Observer(BaseModel):
|
||||
latitude: float
|
||||
longitude: float
|
||||
@ -7,19 +8,22 @@ class Observer(BaseModel):
|
||||
min_elevation: int = 15
|
||||
good_elevation: int = 50
|
||||
|
||||
|
||||
class CalDav(BaseModel):
|
||||
uri: str
|
||||
username: str
|
||||
password: str
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
n2yo_api_key: str
|
||||
satellites_file: str = "satellites.toml"
|
||||
observer: Observer
|
||||
caldav: CalDav
|
||||
|
||||
|
||||
class Config:
|
||||
env_file = ".env"
|
||||
env_nested_delimiter = '_'
|
||||
env_nested_delimiter = "_"
|
||||
|
||||
|
||||
settings = Settings()
|
||||
|
Loading…
Reference in New Issue
Block a user