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

feat: get data from phatnguoi.vn #38

Merged
merged 11 commits into from
Jan 15, 2025
8 changes: 3 additions & 5 deletions src/check_phat_nguoi/get_data/engines/phat_nguoi.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(self) -> None:
def get_violations(html: str):
soup = BeautifulSoup(html, "html.parser")
violation_htmls: ResultSet[BeautifulSoup] = soup.find_all("tbody")
if violation_htmls == []:
if violation_htmls is None:
KevinNitroG marked this conversation as resolved.
Show resolved Hide resolved
return
violation_detail_set: set[ViolationDetail] = set()

Expand Down Expand Up @@ -72,10 +72,8 @@ def _get_violation(violation_html: BeautifulSoup):
return tuple(violation_detail_set)

async def _request(self, plate_info: PlateInfo) -> str | None:
url = (
API_URL_PHATNGUOI
+ plate_info.plate
+ f"/{get_vehicle_enum(plate_info.type)}/"
url: str = (
f"{API_URL_PHATNGUOI}{plate_info.plate}/{get_vehicle_enum(plate_info.type)}"
)
try:
async with self._session.get(url=url) as response:
Expand Down
Loading