Skip to content

Commit ff8e51f

Browse files
CptKKKKCptKKKK
CptKKKK
authored and
CptKKKK
committed
Follow rules by ITC to obtain the acid value
1 parent acba3e6 commit ff8e51f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/bitsrun/user.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,14 @@ 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+
# use http to visit another site, redirect by srun to 10.0.0.55 to get url params (ac_id, theme, wlanuserip, etc.)
49+
# but better to check since the user may have been authenticated
4950
resp = self.client.get('/', follow_redirects=True)
50-
self.acid = resp.url.params.get('ac_id')
51+
resp_valid = httpx.Client(base_url='http://www.bit.edu.cn').get('/', follow_redirects=True)
52+
if resp_valid.url.params.get('ac_id') is None:
53+
self.acid = resp.url.params.get('ac_id')
54+
else:
55+
self.acid = resp_valid.url.params.get('ac_id')
5156

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

0 commit comments

Comments
 (0)