zoukankan      html  css  js  c++  java
  • 十分钟搞定接口功能测试

    如果你和我一样菜,请快速看一下如何快速测试接口!

    1 安装python环境,这里请大家百度!
    2 下载python模块:链接: https://pan.baidu.com/s/1hsByrdE 密码: 4gya
    3 将模块解压后放到D:PythonPython36这个目录下,即:python36的home目录!
    4 cmd到D:PythonPython36
    5 python setup.py install
    6 打开pycham,书写代码:

    # coding:utf-8
    import  requests
    
    #获取验证码  2.6.1
    # ANDROID_MAC:  A4:C1:A0:5A:07:C9    UUID:   34ea2bb748b26643f6093b39b8a144
    print("获取验证码")
    payload = {'mobile':'17004969942','type':'1','device':' A4:C1:A0:5A:07:C9}
    r = requests.post('http://服务器地址+端口/entrance/code', params=payload)
    print(r.status_code,"   ",r.text)
    payload = {'mobile':'18576816231','type':'1','device':'34ea2bb748b26643f6093b39b8a144'}
    r = requests.post('http://服务器地址+端口/entrance/code', params=payload)
    print(r.status_code,"   ",r.text)
    payload = {'mobile':'18576816231','type':'0','device':' A4:C1:A0:5A:07:C9'}
    r = requests.post('http://服务器地址+端口/entrance/code', params=payload)
    print(r.status_code,"   ",r.text)
    payload = {'mobile':'18576816231','type':'0','device':'asdfasdfasdfasdfasdfasdf'}
    r = requests.post('http://服务器地址+端口/entrance/code', params=payload)
    print(r.status_code,"   ",r.text)
    print()
    

    7 执行代码,查看结果

    D:PythonPython36python.exe D:/Python/Python36/work/testre.py
    获取验证码
    200     {"code":"0","message":"","content":{}}
    200     {"code":"01000001","message":"验证码请求已经达到上限"}
    200     {"code":"00000004","message":"用户信息已过期,请重新登录"}
    200     {"code":"00000004","message":"用户信息已过期,请重新登录"}
    

    写这篇博客是因为,当年本人搞了10个10分钟,搞不定,然后果断放弃了,最近发现好多人都卡在环境的安装上!
    如果你十分钟搞不定,那再来十分钟,还搞不定,来群里219537016问问,虽然我可能那时候又不会了!

  • 相关阅读:
    一句SQL查询没门课程都低于80分的学生信息
    ★查询给定字符串中,出现最多的字符和出现的次数
    Eclipse自动加载源码----Attach Java Source
    Eclipse 修改workspace默认的字符集为 utf-8
    浅谈 Spring的AOP的实现 -- 动态代理
    浅谈高并发的理解
    为什么使用单例模式?
    正排索引 与 倒排索引
    图片裁剪
    微信小程序开发笔记
  • 原文地址:https://www.cnblogs.com/wujianqinjian/p/7771792.html
Copyright © 2011-2022 走看看