Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
alefazaxdd committed Oct 25, 2023
0 parents commit 2cde49e
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 0 deletions.
69 changes: 69 additions & 0 deletions README.MD
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)
```
49 changes: 49 additions & 0 deletions __init__.py
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)

0 comments on commit 2cde49e

Please sign in to comment.