Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Information.mark_as_read() raises PronoteAPIError #180

Open
amiguet opened this issue Oct 13, 2022 · 8 comments
Open

Information.mark_as_read() raises PronoteAPIError #180

amiguet opened this issue Oct 13, 2022 · 8 comments
Labels
bug Something isn't working

Comments

@amiguet
Copy link

amiguet commented Oct 13, 2022

With this simplified code:

client = pronotepy.ParentClient(...)
objs = client.information_and_surveys()
objs[0].mark_as_read(True)

I get

Traceback (most recent call last):
  File ".../venv/lib/python3.10/site-packages/pronotepy/clients.py", line 684, in post
    return self.communication.post(function_name, post_data)
  File ".../venv/lib/python3.10/site-packages/pronotepy/pronoteAPI.py", line 184, in post
    raise PronoteAPIError(
pronotepy.exceptions.PronoteAPIError: Unknown error from pronote: 8 | La page a expiré ! (1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File ".../pronotebridge.py", line 31, in <module>
    o.mark_as_read(True)
  File ".../venv/lib/python3.10/site-packages/pronotepy/dataClasses.py", line 933, in mark_as_read
    self._client.post("SaisieActualites", 8, data)
  File ".../venv/lib/python3.10/site-packages/pronotepy/clients.py", line 693, in post
    return self.communication.post(function_name, post_data)
  File ".../venv/lib/python3.10/site-packages/pronotepy/pronoteAPI.py", line 184, in post
    raise PronoteAPIError(
pronotepy.exceptions.PronoteAPIError: Unknown error from pronote: 20 | La page a expiré ! (11)

(there's also quite a bit of debug data, tell me if you need to know more).

Any idea what's happening?

@bain3
Copy link
Owner

bain3 commented Nov 15, 2022

Hi, I'm not sure what could be the problem. Maybe it had a question in it that had to be filled? I could try and change marqueLueSeulement to true, but the web client does not do that. It currently works when I try it with the demo site.

@bain3 bain3 added the bug Something isn't working label Nov 15, 2022
@amiguet
Copy link
Author

amiguet commented Nov 19, 2022

No idea what the problem is. No question to answer, just plain text messages. Some have attachments, but the same error occurs whether there are attachments or not.

Tell me if you need more information to better understand what's happening.

In the meantime, I'm keeping a local list of digests of messages with a local read-status. Not ideal, but an acceptable workaround for my use case.

@bain3
Copy link
Owner

bain3 commented Nov 19, 2022

Can you please try to catch the request that the browser makes when you click the "mark as read" button? The body of the request should have a "nom": "SaisieActualites" hopefully. Clicking the button fires two requests, it should be the first one.

image

The structure of the body of the request is the important bit. You can censor it all :)

@amiguet
Copy link
Author

amiguet commented Nov 19, 2022

Yes it fires two requests,the first of which contains a "nom": "SaisieActualites". The request seems much shorter in my case, though:

image

@bain3
Copy link
Owner

bain3 commented Nov 19, 2022

Huh, not sure why your firefox does not parse the json inside donneesSec. Could you paste the contents of donneesSec here? Of course with personal info removed.

@amiguet
Copy link
Author

amiguet commented Nov 19, 2022

donneesSec is a long (672 chars) string of alphanumeric data (like 'c3fbdf9c971c61dac...'). Probably a hex encoding of some sort...

That probably explains why firefox doesn't parse it, but isn't very helpful otherwise, I'm afraid...

@bain3
Copy link
Owner

bain3 commented Nov 19, 2022

Aha! That must be encrypted+compressed data then. Interesting... That is actually very helpful, because it means that pronotepy's encryption+compression works. Do all the requests look like that (are all donneesSec just a hex string)? They should, just checking.

@amiguet
Copy link
Author

amiguet commented Nov 19, 2022

Yes AFAICT they seem to all look like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants