EdupageAPI / edupage-api

A python library for accessing your Edupage account
https://edupageapi.github.io/edupage-api/
GNU General Public License v3.0
67 stars 13 forks source link

[Feature request] Events #19

Closed cfpwastaken closed 3 years ago

cfpwastaken commented 3 years ago

Is your feature request related to a problem? Please describe. It's possible without but without events you would need to save the last ID you handled into a file and then watch for new stuff constantly. It would be nice if you can just have Events that run user-defined functions when something happens.

Describe the solution you'd like That you can have functions that get called when something happens (ex. new homework comes in)

ivanhrabcak commented 3 years ago

Thank you, great suggesstion! I will be trying to implement notifications the following week, so I'll try adding this!

ivanhrabcak commented 3 years ago

Hello, although there is currently no way to listen for events, there is a way to fetch notifications which is in a way the same thing you requested here.

If you do not like how this feature works, please reply with suggestions. Otherwise please comment here so I can close this issue.

cfpwastaken commented 3 years ago

I don't really know what you mean? Can you give me an example please I can't seem to figure out what you mean by "fetch notifications"

ivanhrabcak commented 3 years ago

You can now call get_notifications like this:

edupage = Edupage("school", "username", "password")
edupage.login()

notifications = edupage.get_notifications()

This method returns a list of the type EduNotification which looks like this:

class EduNotification:
        id
        event_type         
        author 
        recipient 
        text
        date_added
        attachments
        subject
        name
        due_date
        grade
        start
        end 
        duration
        event_type_name
cfpwastaken commented 3 years ago

This is not what I was asking for but I could work with this too. Thx