예제 #1
0
async def helloWorld(request, tag=None):

    return response.html('''
            <div>
                <h1>
                    hello, {}
                </h1>
            </div>'''.format(tag))
예제 #2
0
async def helloWorld(request, foodname=None, gram=100):
    food = SearchFood(foodname, gram=gram)
    await food.search()

    food_specs = food.specs

    rsp_html = '''
            <div>
               <p>名字:{}</p>
                <p>热量:{}</p>
                <p>碳水化合物:{}</p>
                <p>脂肪:{}</p>
                <p>蛋白质:{}</p>
            </div>'''.format(food_specs['real_name'], food_specs['cal'],
                             food_specs['碳水化合物'], food_specs['脂肪'],
                             food_specs['蛋白质'])
    return response.html(rsp_html)
예제 #3
0
 def post(self, request):
     return response.html('<h1>post</h1>')
예제 #4
0
 def get(self, request):
     return response.html('<h1>class view test</h1>')
예제 #5
0
파일: server.py 프로젝트: YoungZiyi/LuyWeb
 def write_error(self):
     response = html('bad connecton', status=400)
     self.write_response(response)
     self.transport.close()