Closed iceFbr closed 9 months ago
fix it, i am sorry. Messed up when implementing proxy over your code kkk
(just added read_message after capturing the last message receveid... but would be a nice fix over client.py, no? )
The wait_for_new_message
method is supposed to wait for a new message, but not read it. If you need you can read it further:
new_message = proton.wait_for_new_message()
new_message = proton.read_message(new_message)
The user is not always required to read the received message. Depending on the subject of the message or the sender, the user can decide whether to read the message or not.
new_message = proton.wait_for_new_message()
if "authorization code" in new_message:
new_message = proton.read_message(new_message)
html = new_message.body
... # parse html
else:
proton.delete_messages([new_message])
Forcing the user to read a message that he does not want to read at the moment is not the best solution.
But I added read_message
parameter to the wait_for_new_message
method. https://github.com/opulentfox-29/protonmail-api-client/commit/2c0560fa55af7b035547977f3d338ae814616180
new_message = proton.wait_for_new_message(read_message=True)
print(new_message.body) # your html
Really nice job with that api! ty!
btw, is new_message method returning empty body message just for me? =)