python flask get传参

 # !/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import Flask,request
from lib.Mojo.Client import *
import chardet

app = Flask(__name__)
##装饰器作用,是做一个URL与视图函数的映射
@app.route('/api/SMSinfo/')
def sms():
   message = request.args.get('message')
   print message
   print '----------------'
   print type(message)
   print len(message)
   print '----------------'
   phone=request.args.get('phone')
   print phone
   a=New()
   a.LoadDB(message,phone);
   return message+str(phone)
#print phone
# return {"param":request.args.get('abc')}

if __name__ == '__main__':
   app.run(host='0.0.0.0',port=6001,debug=True)
   
   [root@yyjk flask]# python mojo.py 
 * Running on http://0.0.0.0:6001/ (Press CTRL+C to quit)
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 677-847-682
中国
----------------
<type 'unicode'>
2
----------------
1234567
lib.Mojo.Client
<lib.Mojo.Client.New object at 0x7fe80383ff50>
2017-11-13 09:36:43.005064
{'phone': u'1234567', 'message': u'u4e2du56fd', 'stime': datetime.datetime(2017, 11, 13, 9, 36, 43, 5064)}
10.5.100.232 - - [13/Nov/2017 09:36:43] "GET /api/SMSinfo/?message=中国&phone=1234567 HTTP/1.1" 200 -

原文地址:https://www.cnblogs.com/hzcya1995/p/13349446.html