pyTempMailsApi is a library that allows you to easily interact with the site https://temp-mail.org/
Project description
pyTempMailsApi
pyTempMailsApi is a library that allows you to easily interact with the site https://temp-mail.org/
Features
- Create a new mailbox
- Get mailbox name
- Get mails list
- get message information by id
- Creating new mailboxes
- Get mailbox name of multiple accounts
- Get emails list of multiple accounts
- Get information about a message by ID from multiple messages
Quick Start
pip install py-temp-mails-api
Class tempMailApi and tempMailApiMultipleData
| Class | variables | import |
|---|---|---|
| tempMailApi | token | from requests import Session |
| tempMailApiMultipleData | tokenList | from grequests import get, post, map |
tempMailApi (requests)
| def | variables | return | # |
|---|---|---|---|
| createNewMailBox | None | dict | creates a new mailbox and gets a dict: token, mailbox (it is not necessary to transfer the token) |
| getMailBox | None | str | gets the name of the mailbox (token required) |
| getMailsList | None | list | gets a list of messages [0 element is the first message] (token required) |
| getMailById | id | dict | get message information by id (it is not necessary to transfer the token) |
from pytempmailsapi import tempMailApi
def test():
#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)
| def | variables | return | # |
|---|---|---|---|
| createNewMailBoxesMultipleData | qty | list | creates a new mailboxes and gets a dict: token, mailbox [Max qty =500!] (it is not necessary to transfer the token) |
| getMailBoxesMultipleData | None | list | gets the name of the mailboxes (token required) |
| getMailsListMultipleData | None | list | gets a dict: mailbox, messages [0 element is the first message] (token required) |
| getMailsByIdMultipleData | idList | list | gets a dict: _id, receivedAt, user, mailbox, from, subject, bodyPreview, bodyHtml, attachmentsCount, attachments, createdAt (it is not necessary to transfer the token) |
from pytempmailsapi import tempMailApiMultipleData
def testMultipleData():
#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'] for regAccount in regAccountListMultipleData])
#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()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file py-temp-mails-api-1.36.tar.gz.
File metadata
- Download URL: py-temp-mails-api-1.36.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1578fa2ba0ed01d2b6b90ac607a151dd86f13e94db91f5382d4305321b4bb72d
|
|
| MD5 |
e4724c49a3bcb984152eeffa48de649d
|
|
| BLAKE2b-256 |
ee5f528127ea430f4144ecd43f2c9668b62a1f4032d031634151465554706ad3
|