24 lines
388 B
Python
24 lines
388 B
Python
|
# -*- coding: UTF-8 -*-
|
||
|
import web
|
||
|
from mod.news import News
|
||
|
|
||
|
urls = (
|
||
|
'/news','api',
|
||
|
)
|
||
|
|
||
|
# render = web.template.render('templates')
|
||
|
app = web.application(urls, globals())
|
||
|
|
||
|
|
||
|
#api的方法
|
||
|
class api:
|
||
|
def GET(self):
|
||
|
news = News()
|
||
|
return news.content()
|
||
|
def POST(self):
|
||
|
news = News()
|
||
|
return news.content()
|
||
|
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
app.run()
|