Skip to content

Commit

Permalink
fix: 예치금 조회 기능 오류 (roeniss#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
an14700 committed Mar 10, 2024
1 parent dbe3cb0 commit d0b5ac4
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/dhapi/port/lottery_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,26 @@ def show_balance(self):
resp = requests.get(self._cash_balance, headers=self._headers, timeout=10)
soup = BeautifulSoup(resp.text, "html5lib")

has_bank_account = soup.select_one(".tbl_total_account_number_top tbody tr td").contents != []
elem = soup.select("div.box.money")
elem = elem[0]

총예치금 = self._parse_digit(elem.select("p.total_new > strong")[0].contents[0])
구매가능금액 = self._parse_digit(elem.select("td.ta_right")[3].contents[0])
예약구매금액 = self._parse_digit(elem.select("td.ta_right")[4].contents[0])
출금신청중금액 = self._parse_digit(elem.select("td.ta_right")[5].contents[0])
구매불가능금액 = self._parse_digit(elem.select("td.ta_right")[6].contents[0]) # (예약구매금액 + 출금신청중금액)
이번달누적구매금액 = self._parse_digit(elem.select("td.ta_right")[7].contents[0])
if has_bank_account is True:
# 간편충전 계좌번호가 있는 경우
총예치금 = self._parse_digit(elem.select("p.total_new > strong")[0].contents[0])
구매가능금액 = self._parse_digit(elem.select("td.ta_right")[3].contents[0])
예약구매금액 = self._parse_digit(elem.select("td.ta_right")[4].contents[0])
출금신청중금액 = self._parse_digit(elem.select("td.ta_right")[5].contents[0])
구매불가능금액 = self._parse_digit(elem.select("td.ta_right")[6].contents[0]) # (예약구매금액 + 출금신청중금액)
이번달누적구매금액 = self._parse_digit(elem.select("td.ta_right")[7].contents[0])
else:
# 간편충전 계좌번호가 없는 경우
총예치금 = self._parse_digit(elem.select("p.total_new > strong")[0].contents[0])
구매가능금액 = self._parse_digit(elem.select("td.ta_right")[1].contents[0])
예약구매금액 = self._parse_digit(elem.select("td.ta_right")[2].contents[0])
출금신청중금액 = self._parse_digit(elem.select("td.ta_right")[3].contents[0])
구매불가능금액 = self._parse_digit(elem.select("td.ta_right")[4].contents[0]) # (예약구매금액 + 출금신청중금액)
이번달누적구매금액 = self._parse_digit(elem.select("td.ta_right")[5].contents[0])

self._lottery_endpoint.print_result_of_show_balance(총예치금, 구매가능금액, 예약구매금액, 출금신청중금액, 구매불가능금액, 이번달누적구매금액)

Expand Down

0 comments on commit d0b5ac4

Please sign in to comment.