This file contains hidden or 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
SENDGRID_API_KEY=your-sendgrid-api-key-goes-here | |
FROM_EMAIL=your-email-address | |
TO_EMAIL=your-email-address |
This file contains hidden or 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
$ flask run |
This file contains hidden or 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
try: | |
resp = sg.send(create_message(error_tb)) | |
except Exception as exc: | |
print(exc.message) |
This file contains hidden or 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
sg = sendgrid.SendGridAPIClient() |
This file contains hidden or 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
SENDGRID_API_KEY=your-sendgrid-api-key-goes-here | |
FROM_EMAIL=your-email-address | |
TO_EMAIL=your-email-address |
This file contains hidden or 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
import os | |
import traceback | |
from flask import Flask | |
from werkzeug.exceptions import InternalServerError | |
import sendgrid | |
from dotenv import load_dotenv | |
load_dotenv() | |
app = Flask(__name__) | |
sg = sendgrid.SendGridAPIClient() |
This file contains hidden or 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
import traceback | |
from flask import Flask | |
from werkzeug.exceptions import InternalServerError | |
app = Flask(__name__) | |
@app.errorhandler(InternalServerError) | |
def handle_500(e): | |
error_tb = traceback.format_exc() |
This file contains hidden or 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
$ flask run |
This file contains hidden or 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
from flask import Flask | |
app = Flask(__name__) | |
class BigBangException(Exception): | |
pass | |
@app.route("/") |
This file contains hidden or 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
$ flask run |
NewerOlder