Skip to content
This repository has been archived by the owner on Jan 18, 2025. It is now read-only.

Commit

Permalink
refactor(constants): split constants.py into multiple files for bette…
Browse files Browse the repository at this point in the history
…r organization
  • Loading branch information
NTGNguyen committed Dec 28, 2024
1 parent a1a4d81 commit d8111ee
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/check_phat_nguoi/modules/constants/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from typing import LiteralString

CONFIG_PATHS: list[LiteralString] = [
"config.json",
"check-phat-nguoi.config.json",
"~/check-phat-nguoi.config.json",
]
SIMPLE_LOG_MESSAGE: LiteralString = "[%(levelname)s]: %(message)s"
DETAIL_LOG_MESSAGE: LiteralString = (
"%(asctime)s [%(levelname)s] - %(message)s (%(filename)s:%(lineno)d)"
)
12 changes: 12 additions & 0 deletions src/check_phat_nguoi/modules/constants/get_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from typing import LiteralString

# API from checkphatnguoi.vn
GET_DATA_API_URL_CHECKPHATNGUOI: LiteralString = (
"https://api.checkphatnguoi.vn/phatnguoi"
)
SEND_MESSAGE_API_URL_TELEGRAM: LiteralString = (
"https://api.telegram.org/bot{bot_token}/sendMessage"
)
DATETIME_FORMAT_CHECKPHATNGUOI: LiteralString = "%H:%M, %d/%m/%Y"

OFFICE_NAME_PATTERN = r"^\d+\."
29 changes: 29 additions & 0 deletions src/check_phat_nguoi/modules/constants/notify.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from typing import LiteralString

SEND_MESSAGE_API_URL_TELEGRAM: LiteralString = (
"https://api.telegram.org/bot{bot_token}/sendMessage"
)
MESSAGE_MARKDOWN_PATTERN: LiteralString = """
*🚗 **Thông tin phương tiện**:*
- **Biển kiểm soát:** `{plate}`
- **Chủ sở hữu:** `{owner}'
*⚠️ **Thông tin vi phạm**:*
- **Hành vi vi phạm:** `{action}`
- **Trạng thái:** {status}
- **Thời gian vi phạm:** `{date}`
- **Địa điểm vi phạm** {location}
*🏢 **Đơn vị phát hiện vi phạm**:*
- **{enforcement_unit}**
*📍 **Nơi giải quyết vụ việc**:*
{resolution_locations}
"""

RESOLUTION_LOCATION_MARKDOWN_PATTERN: LiteralString = """
{idx}. **{location_name}
- **Địa chỉ:** {address}
- **Số điện thoại liên lạc:** {phone}
"""

0 comments on commit d8111ee

Please sign in to comment.