A package for generating mails and addresses
Project description
FauxSynth
The Python package for generating addresses, temporary emails, fake names, fake credit card numbers, fake phone numbers, fake jobs, fake profiles, fake companies, fake credit reports, fake identities, and more. It scrapes the data from the internet and generates fake data for you.
Table of Contents
Installation
Download this repository and run the following command in the terminal to install the required packages.
pip install -r requirements.txt
Usage
Random Address
FauxSynth provides multiple AddressGenerators
present in FauxSynth.address
module.
Each AddressGenerator
can generate multiple addresses from different countries.
In this example we will use the BestRandoms
address generator to generate random addresses from the United States.
from FauxSynth.address import BestRandoms
from FauxSynth.types import Country
# Create an instance of the AddressGenerator
address_generator = BestRandoms(Country.UnitedStates)
# Generate a random address
address = address_generator.get_address()
print(address)
# Generate multiple addresses
addresses = address_generator.get_addresses(5)
print(addresses)
# Access the address fields
print(address.street)
Temporary Email
FauxSynth provides multiple MailHandler
present in FauxSynth.mail
module.
Each MailHandler
can generate temporary emails.
In this example we will use the FakeMail
mail handler to generate a temporary email.
from FauxSynth.mail import FakeMail
mail_handler = FakeMail()
# FakeMail automatically has a random address.
# You can access it using the `address` property.
print(mail_handler.address)
# You can also generate a new random address by creating a new generator.
# Or claim a new address with `claim_mail()`
# Also check if the address is available with `check_mail()`
new_address = "max.mustermann"
if mail_handler.check_mail(new_address):
mail_handler.claim_mail(new_address)
print(mail_handler.address)
else:
print("Address already taken")
Receive Emails
To receive Emails using a MailHandler
you can use the refresh()
method.
This method will refresh the inbox and saves the new emails in the mails
property.
The mails
property is a list of Mail
objects. Each Mail
object has the following properties:
sender
: The sender of the emailsubject
: The subject of the emailbody
: The body of the email (Needs to be loaded withload_body()
)
from FauxSynth.mail import FakeMail
mail_handler = FakeMail()
print(f"Current Mail Address: {mail_handler.address}")
# Refresh the inbox
mail_handler.refresh()
# Print the mails
for mail in mail_handler.mails:
print(f"Sender: {mail.sender}")
print(f"Subject: {mail.subject}")
mail.load_body()
print(f"Body: {mail.body}")
print("")
There is also the wait_for_mail()
method.
This method will automatically refresh and wait for a new email to arrive.
from FauxSynth.mail import FakeMail
mail_handler = FakeMail()
# Wait for a new email
new_mail = mail_handler.wait_for_mail(timeout=60, interval=2)
Project details
Release history Release notifications | RSS feed
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 faux-synth-0.1.2.tar.gz
.
File metadata
- Download URL: faux-synth-0.1.2.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebb674b87839dbf2205d50c7080aaac4c7751ef34998119058124b38761b0f5a |
|
MD5 | aea4fb9d764e1cef1365b28a064f31ac |
|
BLAKE2b-256 | 25f800728a08a5a343155bebbf15986bb62da87de02426ab338bff1d6672db80 |