forked from joeVenner/NoBounce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MailCheckerAPI.py
55 lines (36 loc) · 1.3 KB
/
MailCheckerAPI.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import markdown
import markdown.extensions.fenced_code
from flask import Flask,jsonify,request
from app import MailChecker
from pygments.formatters import HtmlFormatter
import os
app = Flask(__name__)
@app.route('/')
def index():
path = os.getcwd()+'/'+'README.md'
readme_file = open(path, "r",encoding="utf8")
md_template_string = markdown.markdown(
readme_file.read(), extensions=["fenced_code"]
)
formatter = HtmlFormatter(style="emacs", full=True, cssclass="codehilite")
css_string = formatter.get_style_defs()
md_css_string = "<style>" + css_string + "</style>"
md_template = md_css_string + md_template_string
return md_template
@app.route('/alldata/<string:email>',methods = ['GET', 'POST'])
def getdata(email : str):
inst = MailChecker()
data = inst.data_gath(email)
return jsonify(data)
@app.route('/istemp/<string:email>',methods = ['GET', 'POST'])
def istemp(email : str):
inst = MailChecker()
data = inst.is_blacklisted(email)
return jsonify(data)
@app.route('/isdelivrable/<string:email>',methods = ['GET', 'POST'])
def isdelivrable(email : str):
inst = MailChecker()
data = inst.is_delivrable(email)
return jsonify(data)
if __name__ == '__main__':
app.run()