23 lines
706 B
Python
23 lines
706 B
Python
from mail_intake.ingestion import MailIntakeReader
|
|
from mail_intake.adapters import MailIntakeGmailAdapter
|
|
from mail_intake.auth import MailIntakeGoogleAuth
|
|
from mail_intake.credentials.pickle import PickleCredentialStore
|
|
|
|
store = PickleCredentialStore(path="token.pickle")
|
|
|
|
auth = MailIntakeGoogleAuth(
|
|
credentials_path="credentials.json",
|
|
store=store,
|
|
scopes=["https://www.googleapis.com/auth/gmail.readonly"],
|
|
)
|
|
auth.get_credentials()
|
|
|
|
adapter = MailIntakeGmailAdapter(auth_provider=auth)
|
|
reader = MailIntakeReader(adapter)
|
|
|
|
for message in reader.iter_messages("from:roshnisingh009@gmail.com"):
|
|
print(message.subject, message.from_email)
|
|
break
|
|
|
|
from pdb import set_trace;set_trace()
|