Change POST_DATETIME_FORMAT to const

This commit is contained in:
Liam Steckler 2025-07-09 18:56:51 -07:00
parent 2bfd4880f4
commit 635097da91

8
scl.py
View file

@ -18,7 +18,7 @@ from sqlalchemy.orm import DeclarativeBase, Mapped, Session, mapped_column
from geospatial import DBGeometry, convert_outage_geometry
REQUESTS_HEADERS = {"User-Agent": "seattlecitylight-mastodon-bot"}
post_datetime_format = "%b %e %l:%M %p"
POST_DATETIME_FORMAT = "%b %e %l:%M %p"
scl_events_url = "https://utilisocial.io/datacapable/v2/p/scl/map/events"
scl_events_response = requests.get(scl_events_url)
@ -271,7 +271,7 @@ def do_initial_post(
est_restoration_post_text = str()
if estimated_restoration_time > datetime.now():
est_restoration_post_text = "\nEst. Restoration: {}\n".format(
estimated_restoration_time.strftime(post_datetime_format)
estimated_restoration_time.strftime(POST_DATETIME_FORMAT)
)
post_text = """Seattle City Light is reporting a {} outage in {}.
@ -282,7 +282,7 @@ Cause: {}
{}""".format(
event_class["size"].lower(),
area_text,
start_time.strftime(post_datetime_format),
start_time.strftime(POST_DATETIME_FORMAT),
est_restoration_post_text,
event["cause"],
hashtag_string,
@ -382,7 +382,7 @@ with Session(engine) as session:
updated_properties.append("estimated restoration")
updated_entries.append(
"Est. Restoration: {}".format(
estimated_restoration_time.strftime(post_datetime_format)
estimated_restoration_time.strftime(POST_DATETIME_FORMAT)
)
)
if event["cause"] != existing_record.cause: