Gmail export with Python

I’m trying to develop an application, in Python, to export GMAIL messages to eml.
Google authentication is already working.

…service = build(‘gmail’, ‘v1’, credentials=creds)…,

Now I don’t know what is the best and fastest method to access the messages and export them, respecting some criteria (date of the messages, for example).
Could you give me an example of the best method to access the messages from a GMAIL.

Thank you

Hello @slad,

Sure. To access mailbox it’s convenient to use IMAP client. Please, study the following docs on how to work with this client in Python Working with IMAP Client|Documentation

Thank you for your interest in our products.