Skip to content
This repository has been archived by the owner on Sep 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #42 from 0ladyshek/master
Browse files Browse the repository at this point in the history
Добавлена авторизация по ID школы
  • Loading branch information
nm17 authored Oct 1, 2021
2 parents 327de5d + 71b685b commit cf7a4dd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions netschoolapi/netschoolapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async def __aenter__(self) -> 'NetSchoolAPI':
async def __aexit__(self, exc_type, exc_val, exc_tb):
await self.logout()

async def login(self, user_name: str, password: str, school: str):
async def login(self, user_name: str, password: str, school: Union[str, int]):
response_with_cookies = await self._client.get('logindata')
self._client.cookies.extract_cookies(response_with_cookies)

Expand Down Expand Up @@ -228,14 +228,14 @@ async def logout(self):
await self._client.post('auth/logout')
await self._client.aclose()

async def _address(self, school: str) -> Dict[str, int]:
async def _address(self, school: Union[str, int]) -> Dict[str, int]:
response = await self._client.get(
'addresses/schools', params={'funcType': 2}
)

schools_reference = response.json()
for school_ in schools_reference:
if school_['name'] == school:
if school_['name'] == school or school_['id'] == school:
self._school_id = school_['id']
return {
'cid': school_['countryId'],
Expand Down

0 comments on commit cf7a4dd

Please sign in to comment.