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.38.tar.gz (3.4 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: py-temp-mails-api-1.38.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

Hashes for py-temp-mails-api-1.38.tar.gz
Algorithm Hash digest
SHA256 485d34d254823aae885d9ac188c0c2a194e640f464aaceb324adf9116eacf624
MD5 f589bfbb6856b30fb53ef2d694100973
BLAKE2b-256 e388fb5f52000d19bc1cc85583eddfc9b14abc979d46c5925bac42cdf3e63234

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