[Feature request] Filter done in forloops
Closed this issue · 5 comments
Is there any way to filter done homeworks in forloops (code bellow)?
for hw in homework:
print(hw.due_date)
print(hw.title)
print(hw.description)
If not could you add it?
Ok, I can implement it when I have time, at the same time as #9
(It kinda is the same thing)
Thank you!
Now that notifications are implemented, you can do this.
I am going to publish this feature to pip, but expect changes; I think there are improvements to be made. If you are satisfied on how this feature works, please reply so I can close this issue.
I did not figure it out how to do it (I am not good with python) plese coud you send me an example?
Sorry, it isn't documented yet.
from edupage_api import Edupage, NotificationType
edupage = Edupage("subdomain", "username", "password")
edupage.login()
notifications = edupage.get_notifications()
for notification in notifications:
if notification.event_type == NotificationType.HOMEWORK:
print(f"{str(notification.due_date)=}")
print(f"{notification.name=}")
print("--------------------")
You also have access to other properties, that are not specific to homework like:
# ...
print(notification.recipient)
print(notification.date_added)
print(notification.author)
Is that enough for you, or do you think something is missing?