48 lines
1 KiB
Python
Executable file
48 lines
1 KiB
Python
Executable file
#!/usr/bin/python3
|
|
|
|
"""Fetch new mail notifications for i3blocks.
|
|
|
|
Author: flyingscorpio
|
|
"""
|
|
|
|
import argparse
|
|
import requests
|
|
|
|
|
|
def parse_cli() -> argparse.Namespace:
|
|
"""Parse credentials from the command line."""
|
|
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("username")
|
|
parser.add_argument("password")
|
|
|
|
return parser.parse_args()
|
|
|
|
|
|
def main(args: argparse.Namespace) -> None:
|
|
"""Connect to ProtonMail."""
|
|
|
|
with requests.Session() as session:
|
|
main_url = "https://mail.protonmail.com"
|
|
|
|
req = session.get(main_url)
|
|
|
|
print(req.cookies)
|
|
|
|
req = session.post(
|
|
"https://mail.protonmail.com/api/auth",
|
|
data={
|
|
"Username": "tfranken@protonmail.com",
|
|
"ClientEphemeral": "123",
|
|
"ClientProof": "123",
|
|
"SRPSession": "123",
|
|
},
|
|
headers={
|
|
"x-pm-appversion": "Web_3.16.23",
|
|
},
|
|
)
|
|
print(req.text)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main(parse_cli())
|