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

Commit

Permalink
Исправление десериализации
Browse files Browse the repository at this point in the history
Поле `mark` в некоторых дневниках может отсутствовать. Не быть `null`, а именно отсутствовать. Ужас...
  • Loading branch information
igorlanov committed May 29, 2021
1 parent 76ff9b0 commit c1127c8
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 20 deletions.
12 changes: 0 additions & 12 deletions .bumpversion.cfg

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

NetSchoolAPI — это асинхронный клиент для «Сетевого города», который может получить дневник с домашними заданиями и оценками, объявления и просроченные задания.

> Библиотека не имеет отношения к «ИрТеху».
> Библиотека не имеет отношения к «ИрТеху»
**Установка, пример проекта, описание методов и датаклассов описано в [документации](https://netschoolapi.readthedocs.io/) проекта.**

Expand Down
1 change: 0 additions & 1 deletion docs/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ datetime.date(2021, 4, 21)
* `post_date: date` --- дата, когда объявление было загружено на сайт
* `attachments: list[Attachment]` --- приложения к объявлению


## Attachment {#attachment}

Приложенные файлы к урокам и объявлениям.
Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ nav:
theme: readthedocs

extra:
version: 5.0.1
version: 5.0.2
1 change: 0 additions & 1 deletion netschoolapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@


__all__ = ['NetSchoolAPI']
__version__ = '5.0.0'
2 changes: 1 addition & 1 deletion netschoolapi/netschoolapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self, url: str):
url = url.rstrip('/')
self._client = AsyncClient(
base_url='{0}/webapi'.format(url),
headers={'user-agent': 'NetSchoolAPI/5.0.1', 'referer': url},
headers={'user-agent': 'NetSchoolAPI/5.0.2', 'referer': url},
event_hooks={'response': [_die_on_bad_status]},
)

Expand Down
3 changes: 1 addition & 2 deletions netschoolapi/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,14 @@ class Assignment(NetSchoolAPISchema):

@pre_load
def unwrap_marks(self, assignment: dict[str, Any], **_) -> dict[str, str]:
mark = assignment.pop('mark')
mark = assignment.pop('mark', None)
if mark:
assignment.update(mark)
else:
assignment.update({'mark': None, 'dutyMark': False})
return assignment



class Lesson(NetSchoolAPISchema):
day = fields.Date()
start = fields.Time(data_key='startTime')
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name='netschoolapi',
version='5.0.1',
version='5.0.2',
description='Асинхронный API-клиент для «Сетевого города»',
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down

0 comments on commit c1127c8

Please sign in to comment.