-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2cde49e
Showing
2 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Faza Mail | ||
|
||
Faza Mail is a Python library that provides a simple interface for generating temporary email addresses and checking emails for specific content. | ||
|
||
## Installation | ||
|
||
Install Faza Mail using `pip`: | ||
|
||
```bash | ||
pip install fazamail | ||
``` | ||
|
||
# Quick Start | ||
|
||
```python | ||
import fazamail | ||
|
||
# Generate a temporary email address | ||
address, token = fazamail.mail() | ||
|
||
# Check email content | ||
email_body = fazamail.check_mail(auth=token, url=1) | ||
print(email_body) | ||
|
||
# Check the first URL in the email | ||
first_url = fazamail.check_mail(auth=token, url=2) | ||
print("First URL in the email:", first_url) | ||
|
||
# List all URLs in the email | ||
all_urls = fazamail.check_mail(auth=token, url=3) | ||
print("All URLs in the email:", all_urls) | ||
``` | ||
|
||
# Features | ||
|
||
- Email Generation: Quickly generate a temporary email address. | ||
- Email Checking: Check emails for specific content, extract the first URL, or list all URLs. | ||
|
||
# Usage | ||
|
||
## Generating a temporary Email | ||
|
||
```python | ||
import fazamail | ||
|
||
# Generate a temporary email address | ||
address, token = fazamail.mail() | ||
|
||
print("Temporary Email Address:", address) | ||
print("Authentication Token:", token) | ||
``` | ||
|
||
## Checking Email Content | ||
|
||
```python | ||
import fazamail | ||
|
||
# Use the authentication token to check email content | ||
email_body = fazamail.check_mail(auth=token, url=1) | ||
print("Email Body:", email_body) | ||
|
||
# Check the first URL in the email | ||
first_url = fazamail.check_mail(auth=token, url=2) | ||
print("First URL in the email:", first_url) | ||
|
||
# List all URLs in the email | ||
all_urls = fazamail.check_mail(auth=token, url=3) | ||
print("All URLs in the email:", all_urls) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import requests | ||
import json | ||
import time | ||
import re | ||
|
||
url_pattern = re.compile(r'https?://[^\s>"]+|www\.[^\s>"]+') | ||
|
||
headers = {'User-Agent': 'TempMailPuppeteerAPI/1.0', 'Accept': 'application/json'} | ||
|
||
|
||
def mail(): | ||
response = requests.get('https://api.tempmail.lol/generate/rush', headers=headers) | ||
data = json.loads(response.text) | ||
return data['address'], data['token'] | ||
|
||
|
||
def get_email_body(email_data): | ||
if len(email_data['body']) < 50: | ||
return email_data['html'] | ||
else: | ||
return email_data['body'] | ||
|
||
|
||
def check_mail(auth = "", url=1): | ||
while True: | ||
response = requests.get(f'https://api.tempmail.lol/auth/{auth}', headers=headers) | ||
email = json.loads(response.text)['email'] | ||
|
||
if len(email) > 0: | ||
email_data = email[0] | ||
if url == 2: | ||
data = get_email_body(email_data) | ||
match = url_pattern.search(data) | ||
if match: | ||
return match.group() | ||
else: | ||
return f"no url found {data} {email_data}" | ||
elif url == 1: | ||
return get_email_body(email_data) | ||
elif url == 3: | ||
data = get_email_body(email_data) | ||
match = url_pattern.findall(data) | ||
if match: | ||
return match | ||
else: | ||
return f"no urls found: {data} {email_data}" | ||
|
||
|
||
time.sleep(5) |