Skip to main content

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

py-temp-mails-api-1.35.tar.gz (3.1 kB view details)

Uploaded Source

File details

Details for the file py-temp-mails-api-1.35.tar.gz.

File metadata

  • Download URL: py-temp-mails-api-1.35.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for py-temp-mails-api-1.35.tar.gz
Algorithm Hash digest
SHA256 19c2e95b548d8ade00d1e515df19b6903d5691d446a2a3a5499a4b561544e3fc
MD5 1fc89937293cd951f368993666072ae8
BLAKE2b-256 9e79a2551754d990242d317d62a1569f028818a3b4571996fc4f1b005299dafe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page