forked from huxuan/xiami_auto_checkin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.wsgi
executable file
·42 lines (32 loc) · 1015 Bytes
/
index.wsgi
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
# -*- coding:utf-8 -*-
from bottle import Bottle, run
from sae import create_wsgi_app
from sae.mail import send_mail
import json
import pprint
import traceback
import xiami
app = Bottle()
@app.route('/')
def hello():
return "Hello, world! - Bottle"
@app.route('/xiami_checkin_xxx', method='GET')
def xiami_checkin():
try:
results = xiami.work()
send_mail("your_mail@xxx.com",
results.get("title", "SAE"),
pprint.pformat(results.get("content", "{}")),
("smtp.sina.com", 25, "your_mail@xxx.com", "your_mail_password", False))
page = results
except Exception, err:
page = traceback.format_exc()
return page
@app.route('/mail_test_xxx', method='GET')
def mail_test():
send_mail("your_mail@xxx.com",
"Hello from SAE",
"Test SAE mail",
("smtp.sina.com", 25, "your_mail@xxx.com", "your_mail_password", False))
return "done"
application = create_wsgi_app(app)