• flask架构中的方法学习


    from flask import Flask, render_template, jsonify, request
    # import flask
    import requests
    import json
    import config
    
    
    
    
    
    import paramiko
    from functools import wraps
    import socket
    import json
    
    app = Flask(__name__)
    
    @app.route('/post',methods=['POST','GET'])
    def post():
        method = request.method  #记录请求使用的HTTP方法
        args = request.args      #记录请求中的查询参数
        data = request.data      #记录请求数据,并转化为字符串
        # cookie = request.cookie
        form = request.form
        url= request.url
        files = request.files
        '''
        request模块学习连接https://www.jianshu.com/p/77a123482d8f
        小辣椒 http://docs.jinkan.org/docs/flask/quickstart.html
               http://docs.jinkan.org/docs/flask/patterns/fileuploads.html#uploading-files
        
        
        '''
        print(url)
        print(args)
        print(json.dumps(str(data)))
        print(request.files)
        print(type(request.files))
        print('取值文件名方法一')
        print(request.files['myfile'])
        print(request.files['myfile'].filename)
        print('取值文件名方法二')
        f = request.files.get('file_name')
        print(f.filename)
    
        dict01 = dict(request.files)
        print(dict01['file_name'])
        # print((dict01['file_name'].__name__))
    
    
        return (method,args)
    
    if __name__ == '__main__':
        app.run(host="0.0.0.0", port=8888, debug=True)
    request方法学习
  • 相关阅读:
    [SCOI2005]栅栏
    状压dp常用操作
    [SCOI2005]互不侵犯
    欧拉函数
    hdu5179 beautiful number
    hdu4460 Friend Chains
    exgcd详解
    hdu6468 zyb的面试
    hdu1978 How many ways
    hdu1312 Red and Black
  • 原文地址:https://www.cnblogs.com/zhuhaofeng/p/12376210.html
Copyright © 2020-2023  润新知