HTTPie

作者: 汤汤汤汤汤雪林 | 来源:发表于2017-02-17 11:52 被阅读79次

    python编写的http测试类工具,可以模拟多种HTTP操作获取数据模型

    pip install httpie    #安装
    

    安装完成后直接命令行输入 httpie 就可获取帮助信息

    操作指令:

    http -f POST www.baidu.com name=name  #模拟表单提交
    
    http -v www.baidu.com     #显示详细的请求信息
    http -h www.baidu,com     #仅显示Header
    http -b www.baidu.com     #仅显示Body
    http -d www.baidu.com     #下载文件
    
    http PUT www.baidu.com name=name password=pwd  #传递json类型参数(字符串)
    http PUT www.baidu.com age:=28 #非字符串类型使用:=分割
    
    http --form POST www.baidu.com name='name'    #模拟form的POST请求
    http -f POST www.baidu.com/files  name='name' file@~/test.txt  #模拟form文件上传
    
    http www.baidu.com User-Agent:Txl/1.0 'Cookie:a=b;b=c' Referer:http://www.baidu.com/
    # 修改请求头,使用:分割
    
    http -a username:password www.baidu.com   #认证
    http --auth--type=digest -a user:pwd www.baidu.com  #认证
    
    http --proxy=http:http://192.168.1.1:8080 www.baidu.com
    # 使用HTTP代理
    

    相关文章

      网友评论

        本文标题:HTTPie

        本文链接:https://www.haomeiwen.com/subject/lsbkwttx.html