Skip to content

Commit

Permalink
Follow rules by ITC to obtain the acid value (#49)
Browse files Browse the repository at this point in the history
Co-authored-by: CptKKKK <[email protected]>
Co-authored-by: Y.D.X <[email protected]>
  • Loading branch information
3 people authored Apr 7, 2024
1 parent 35b2030 commit f714d41
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/bitsrun/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,17 @@ def __init__(self, username: str, password: str):
# Initialize reused httpx client
self.client = httpx.Client(base_url=_API_BASE)

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

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

0 comments on commit f714d41

Please sign in to comment.