Skip to content

Commit

Permalink
Updated to new version of API
Browse files Browse the repository at this point in the history
  • Loading branch information
VadVergasov committed Sep 8, 2021
1 parent 2655375 commit e04c956
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions api.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def auth(username, password, session):
while retry:
try:
request = session.post(
"https://schools.by/api/auth",
"https://schools.by/v2/api/auth",
data={"username": username, "password": password},
timeout=3,
)
Expand Down Expand Up @@ -72,7 +72,9 @@ def get_info(token, session):
"""
Get user info from schools.by
"""
return _get_request(token, "https://schools.by/subdomain-api/user/current", session)
return _get_request(
token, "https://schools.by/v2/subdomain-api/user/current", session
)


def get_pupils(token, parent_id, session):
Expand All @@ -81,7 +83,7 @@ def get_pupils(token, parent_id, session):
"""
return _get_request(
token,
"https://schools.by/subdomain-api/parent/" + str(parent_id) + "/pupils",
"https://schools.by/v2/subdomain-api/parent/" + str(parent_id) + "/pupils",
session,
)

Expand All @@ -97,7 +99,7 @@ def get_hometask(token, date, pupil_id, session):
)
return _get_request(
token,
"https://schools.by/subdomain-api/pupil/"
"https://schools.by/v2/subdomain-api/pupil/"
+ str(pupil_id)
+ "/daybook/day/"
+ str(year + "-" + month + "-" + day),
Expand All @@ -111,7 +113,7 @@ def get_week(token, date, pupil_id, session):
"""
return _get_request(
token,
"https://schools.by/subdomain-api/pupil/"
"https://schools.by/v2/git subdomain-api/pupil/"
+ str(pupil_id)
+ "/daybook/week/"
+ date.strftime("%Y-%m-%d"),
Expand All @@ -125,7 +127,7 @@ def get_lastpage(token, pupil_id, session):
"""
return _get_request(
token,
"https://schools.by/subdomain-api/pupil/"
"https://schools.by/v2/subdomain-api/pupil/"
+ str(pupil_id)
+ "/daybook/last-page",
session,
Expand Down

0 comments on commit e04c956

Please sign in to comment.