1 year ago

#383739

test-img

J MGrice

Python how to handle imap login when multi threading so not connecting all the time?

I've wrote my first python requests program and it works. Im trying to sign up to a particular website, and while I can do it fine, I want to be able to multithread to make the process more efficient.

problem is as part of my program, it connects to gmail and retrieves a login code. To make the functions easier to write, i have say, 5 emails that are forwarded to my imap account. My function then logs into imap and takes note of the original 'To' header to select the email i want and then takes the code i need.

Obviously, when multithreading, ideally I don't want multiple simultaneous connections to the mailbox as I assume this would cause me issues? Or will it? Im going to text it but figured It might cause problems with gmail due to simultaneous connections

Would I have to create an obhect of some sort where my imap process continuously updates perhaps? And then I can try and write my functions to search there instead? or is there an easier way where I can connect to imap at the start and have any threads using that one connection? Not sure of the best way to handle it

python-3.x

python-requests

imap

0 Answers

Your Answer

Accepted video resources