proton-python-client icon indicating copy to clipboard operation
proton-python-client copied to clipboard

API calls documentation is nowhere to be found

Open ShellCode33 opened this issue 3 years ago • 5 comments

Hey, thanks for this Python module, but I'm not sure I get it...

You provide Python code, talk about APIs, but you don't give a single API endpoint ? Is this repo for internal tooling purposes or do you plan to document the API at some point ?

ShellCode33 avatar Dec 03 '21 21:12 ShellCode33

You provide Python code, talk about APIs, but you don't give a single API endpoint ? Is this repo for internal tooling purposes or do you plan to document the API at some point ?

This is a just a fancy http module to save you time in reverse engineering. I have provided a starting point incase anyone from google comes here. You can get the endpoints simply by looking at the traffic.

from proton_python_client import proton
from proton_python_client.proton.api import Session
from proton_python_client.proton.exceptions import ProtonError
import os 
import pprint 

cwd = os.getcwd()
__allow_alternative_routing__= True

proton_session = Session(
    'https://api.protonmail.ch',
    os.path.join(cwd, "logs"),
    os.path.join(cwd, "cache"),
    

    
    tls_pinning=False,
    
    
)

proton_session.enable_alternative_routing = False
proton_session.authenticate(username= "admin", password ="🧑🎨🎨")



def getMails():
   info_response = proton_session.api_request("/mail/v4/conversations")
   for conversation in info_response['Conversations']:
	   get_email_id = conversation['ID']
	   get_email_content= proton_session.api_request("/mail/v4/conversations/" + get_email_id)
	   pprint.pprint(get_email_content)

Nllii avatar May 01 '22 23:05 Nllii

there is no ProtonDrive implementation right? thanks

dademiller360 avatar Dec 25 '22 17:12 dademiller360

Why is this example not in the readme?

pcroland avatar Jan 04 '23 21:01 pcroland

This worked for me, thank you!

Do you know how I can decode the email body properly?

decoded_body = base64.b64decode(body).decode('utf-8')

Returns garbage.

twintersx avatar Feb 22 '24 17:02 twintersx

I had to make this change:

from proton.api import Session
from proton.exceptions import ProtonError

from proton_python_client import proton from proton_python_client.proton.api import Session from proton_python_client.proton.exceptions import ProtonError

CaffeineLab avatar Apr 24 '24 21:04 CaffeineLab