Issue Description
The QR code login flow never completes - check_state() never returns CONF or DONE status even after user scans and confirms the QR code.
Environment
- macOS
- bilibili-api Python library
- Python 3.12
Steps to Reproduce
- Run
python bili_login.py
- Scan QR code with Bilibili app
- Confirm login on phone
- Script continues to print "已扫码,请在手机上确认..." indefinitely
Expected Behavior
- After QR scan + confirmation,
check_state() should return QrCodeLoginEvents.CONF then QrCodeLoginEvents.DONE
- Credentials should be saved to
bili_credential.json
Actual Behavior
- Script loops forever showing "已扫码,请在手机上确认..."
check_state() keeps returning QrCodeLoginEvents.SCAN (1) instead of CONF (2) or DONE (3)
- No credential file is ever created
Possible Root Cause
- The bilibili-api library may have changed its enum values
- Or network issue with B站 API
- Or the check_state() is not properly detecting the confirmation
Workaround Attempted
- Modified MCP server to check credential file first (didnt help as file is never created)
- Used multiple QR code scans
Code Analysis
The login loop in bili_login.py:
while True:
state = await qr.check_state()
if state == QrCodeLoginEvents.SCAN:
print("已扫码,请在手机上确认...")
elif state == QrCodeLoginEvents.CONF:
print("已确认...")
# ...
await asyncio.sleep(2)
The issue is that check_state() always returns SCAN even after confirmation.
Issue Description
The QR code login flow never completes -
check_state()never returnsCONForDONEstatus even after user scans and confirms the QR code.Environment
Steps to Reproduce
python bili_login.pyExpected Behavior
check_state()should returnQrCodeLoginEvents.CONFthenQrCodeLoginEvents.DONEbili_credential.jsonActual Behavior
check_state()keeps returningQrCodeLoginEvents.SCAN(1) instead ofCONF(2) orDONE(3)Possible Root Cause
Workaround Attempted
Code Analysis
The login loop in
bili_login.py:The issue is that
check_state()always returnsSCANeven after confirmation.