mirror of
https://github.com/cqwu-ehall/cqwu-ehall.git
synced 2024-11-25 11:46:46 +00:00
28 lines
755 B
Python
28 lines
755 B
Python
|
import cqwu
|
||
|
from cqwu.errors.auth import CookieError
|
||
|
from cqwu.types.epay import PayBillPage
|
||
|
|
||
|
|
||
|
class GetPayBill:
|
||
|
async def get_pay_bill(
|
||
|
self: "cqwu.Client",
|
||
|
page_number: int = 1,
|
||
|
) -> PayBillPage:
|
||
|
"""
|
||
|
获取校园卡消费账单
|
||
|
|
||
|
Returns:
|
||
|
PayBillPage: 消费账单
|
||
|
"""
|
||
|
url = "http://218.194.176.214:8382/epay/thirdapp/bill"
|
||
|
html = await self.oauth(url)
|
||
|
if not html:
|
||
|
raise CookieError()
|
||
|
if html.url != url:
|
||
|
raise CookieError()
|
||
|
data = await self.request.post(
|
||
|
"http://218.194.176.214:8382/epay/thirdapp/loadbill.json",
|
||
|
data={"pageno": page_number}
|
||
|
)
|
||
|
return PayBillPage(**data.json())
|