Skip to content

Commit f714d41

Browse files
CPT-KKCptKKKKYDX-2147483647
authored
Follow rules by ITC to obtain the acid value (#49)
Co-authored-by: CptKKKK <[email protected]> Co-authored-by: Y.D.X <[email protected]>
1 parent 35b2030 commit f714d41

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/bitsrun/user.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,17 @@ def __init__(self, username: str, password: str):
4545
# Initialize reused httpx client
4646
self.client = httpx.Client(base_url=_API_BASE)
4747

48-
# Get `ac_id` from the redirected login page
48+
# Visit another site using HTTP, and let srun redirect to 10.0.0.55
49+
# with url params (ac_id, theme, wlanuserip, etc.)
50+
# but better to check since the user may have been authenticated
4951
resp = self.client.get('/', follow_redirects=True)
50-
self.acid = resp.url.params.get('ac_id')
52+
resp_valid = httpx.Client(base_url='http://www.bit.edu.cn').get(
53+
'/', follow_redirects=True
54+
)
55+
if resp_valid.url.params.get('ac_id') is None:
56+
self.acid = resp.url.params.get('ac_id')
57+
else:
58+
self.acid = resp_valid.url.params.get('ac_id')
5159

5260
# Check current login status and get device `online_ip`
5361
login_status = get_login_status(client=self.client)

0 commit comments

Comments
 (0)