Package: py-temp-mails-api
pyTempMailsApipyTempMailsApi is a library that allows you to easily interact with the sitehttps://temp-mail.org/FeaturesCreate a new mailboxGet mailbox nameGet mails listget message information by idCreating new mailboxesGet mailbox name of multiple accountsGet emails list of multiple accountsGet information about a message by ID from multiple messagesQuick Startpipinstallpy-temp-mails-apiClass tempMailApi and tempMailApiMultipleDataClassvariablesimporttempMailApitokenfrom requests import SessiontempMailApiMultipleDatatokenListfrom grequests import get, post, maptempMailApi (requests)defvariablesreturn#createNewMailBoxNonedictcreates a new mailbox and gets a dict: token, mailbox (it is not necessary to transfer the token)getMailBoxNonestrgets the name of the mailbox (token required)getMailsListNonelistgets a list of messages [0 element is the first message] (token required)getMailByIdiddictget message information by id (it is not necessary to transfer the token)frompytempmailsapiimporttempMailApideftest():#creates a new mailbox and gets a dict: token, mailbox (it is not necessary to transfer the token)regAccount=tempMailApi().createNewMailBox()userTempMail=tempMailApi(token=regAccount['token'])#gets the name of the mailbox (token required)mailBox=userTempMail.getMailBox()#gets a list of messages [0 element is the first message] (token required)getMessages=userTempMail.getMailsList()#get message information by id (it is not necessary to transfer the token)mailId=tempMailApi().getMailById(id='634c9c7d7803b600764ae905')print(f"tempMailApi\n{regAccount=}\n{mailBox=}\n{getMessages=}\n{mailId=}")if__name__=='__main__':test()tempMailApiMultipleData (grequests)defvariablesreturn#createNewMailBoxesMultipleDataqtylistcreates a new mailboxes and gets a dict: token, mailbox [Max qty =500!] (it is not necessary to transfer the token)getMailBoxesMultipleDataNonelistgets the name of the mailboxes (token required)getMailsListMultipleDataNonelistgets a dict: mailbox, messages [0 element is the first message] (token required)getMailsByIdMultipleDataidListlistgets a dict: _id, receivedAt, user, mailbox, from, subject, bodyPreview, bodyHtml, attachmentsCount, attachments, createdAt (it is not necessary to transfer the token)frompytempmailsapiimporttempMailApiMultipleDatadeftestMultipleData():#creates a new mailboxes and gets a dict: token, mailbox [Max qty =500!] (it is not necessary to transfer the token)regAccountListMultipleData=tempMailApiMultipleData().createNewMailBoxesMultipleData(qty=5)usersTempMailMultipleData=tempMailApiMultipleData(tokenList=[regAccount['token']forregAccountinregAccountListMultipleData])#gets the name of the mailboxes (token required)mailBoxMultipleData=usersTempMailMultipleData.getMailBoxesMultipleData()#gets a dict: mailbox, messages [0 element is the first message] (token required)getMessagesMultipleData=usersTempMailMultipleData.getMailsListMultipleData()#gets a dict: _id, receivedAt, user, mailbox, from, subject, bodyPreview, bodyHtml, attachmentsCount, attachments, createdAt (it is not necessary to transfer the token)mailIdMultipleData=tempMailApiMultipleData().getMailsByIdMultipleData(idList=['634c9c7d7803b600764ae905','634ca0659cae5c003a8564ec'])print(f"\n\ntempMailApiMultipleData\n{regAccountListMultipleData=}\n{mailBoxMultipleData=}\n{getMessagesMultipleData=}\n{mailIdMultipleData=}")if__name__=='__main__':testMultipleData()