Closed markmcwiggins closed 4 months ago
I don't understand which input.read(file)
you are talking about, but on Python 3.12 the installation fails due to not all libraries being updated yet. The aiohttp
library cannot be installed due to an error in the multidict
library
But using this answer, you can set the environment variable MULTIDICT_NO_EXTENSIONS=1
and then everything will work:
$Env:MULTIDICT_NO_EXTENSIONS=1
export MULTIDICT_NO_EXTENSIONS=1
Then everything is as usual:
pip install protonmail-api-client
playwright install webkit
Use:
from protonmail import ProtonMail
username = "...@proton.me"
password = "..."
passphrase = '...'
pk = 'privatekey.....asc'
proton = ProtonMail()
proton.login(username, password)
proton.pgp_import(pk, passphrase=passphrase)
messages = proton.get_messages()
print(len(messages))
# I got:
# login success
# _async_get_messages: 100%|██████████| 2/2 [00:00<00:00, 5.60it/s]
# 172
This works for me, but don't forget that that answer says that the MULTIDICT_NO_EXTENSIONS=1
parameter slows down the library by 20-50 times, although I don't know if this matters in this project. I recommend staying on version 3.11 until all other libraries are updated.
Now all libraries are updated and everything works as normal.
You no longer need to use the MULTIDICT_NO_EXTENSIONS=1
option to use Python 3.12
Just:
pip install protonmail-api-client
There's a line in the 3.11 code that uses
input.read(file)
instead of just
input(file)