Ever wanted to interact with the TempMail.lol API using Python but didn’t want to use raw HTTP requests? Well now we got your back.
First off, I would like to say thank you to Alex Torres for making the Python library. You can view the code here, feel free to contribute!
Important – read before using
The TempMail.lol API has a few limitations:
- You must use the token to check for emails within 10 minutes of the last check or the creation of the inbox, otherwise it is deleted.
- Inboxes expire after 1 hour.
Installing
Use the pip
command to install the library:
pip install tempmail-lol
Example Usage
from TempMail import TempMail #imports everything from TempMail library import time #import time module inbox = TempMail.generateInbox() #returns an Inbox object with Email and Token print("Email Address: "+ inbox.address) #View output below print("Authorization Token: "+ inbox.token) #output: """ Email Address: [email protected] Authorization Token: RCfc1og1z1JzuN1mkXL2eFdAc_8uxSRAwcGhUoXuH26e7nnJMdVVtSxxasZLD9D2OHTKIjVEvLhK7S0K5QIanA """ while(True): #Infinite Loop emails = TempMail.getEmails(inbox) #Returns list of Email objects print(emails) # View output below time.sleep(30) #wait 30 sec #output: """ [Email ([email protected], [email protected], subject=Subject line, body=Text Area, html=<div dir="ltr">Text Area</div>, date=1652824961713 )] """
Conclusion
Thanks again to Alex Torres for making the API. If you found it useful or have any suggestions, feel free to ask on GitHub. Let us know what you end up creating!