test
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from flask import Flask, request, jsonify
|
||||
from .config import Config
|
||||
from .utils import get_latest_emails
|
||||
from .utils import get_latest_emails, get_latest_email_with_code
|
||||
|
||||
def create_app():
|
||||
app = Flask(__name__)
|
||||
@@ -15,4 +15,14 @@ def create_app():
|
||||
emails = get_latest_emails(recipient, limit)
|
||||
return jsonify(emails)
|
||||
|
||||
@app.route('/latest_email', methods=['GET'])
|
||||
def get_latest_email():
|
||||
recipient = request.args.get('recipient')
|
||||
if not recipient:
|
||||
return jsonify({'error': 'Recipient email is required'}), 400
|
||||
email_data = get_latest_email_with_code(recipient)
|
||||
if email_data:
|
||||
return jsonify(email_data)
|
||||
return jsonify({'error': 'No emails found for this recipient'}), 404
|
||||
|
||||
return app
|
||||
Reference in New Issue
Block a user