zoukankan      html  css  js  c++  java
  • 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 -

  • 相关阅读:
    2020/10/29
    2020/10/24
    2020/10/28
    2020/10/31周报
    linux shell 中判断字符串为空的正确方法
    20201107 千锤百炼软工人
    20201103 千锤百炼软工人
    20201109 千锤百炼软工人
    20201111 千锤百炼软工人
    20201105 千锤百炼软工人
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349446.html
Copyright © 2011-2022 走看看