EdupageAPI / edupage-api

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

[Bug] ExpiredSessionException in edupage api #61

Closed Dominik26-1 closed 1 year ago

Dominik26-1 commented 1 year ago

Hi, after whole day running my web app server I got this error. ExpiredSessionException at /search/ Invalid gsec hash! (Expired session, try logging in again!)

I am using edupage API package and I know that problem should be with expiration time of edupage login session. But what is propriate fix for this error. Is there some property to set it or I have to ensure login again and used newly retrieved Edupage object.

And another question how long it takes to got this error?
I can not find this information in docs.

Thanks for advice.

BelKed commented 1 year ago

The session expiration time is either 12 or 24 hours.

You can add a try except block to your code:

try:
    # Your code
except ExpiredSessionException:
    edupage.login(…)