Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow rules by ITC to obtain the acid value #49

Merged
merged 3 commits into from
Apr 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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