• 十分钟搞定接口功能测试


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

    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问问,虽然我可能那时候又不会了!

  • 相关阅读:
    repomd.xml signature could not be verified for kubernetes
    在远程连接最小化和关闭后执行失败的解决方案
    docker
    conan buildroot
    UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 250: illegal multibyte sequence
    最小化及关闭远程桌面后键盘与鼠标仍处于可交互状态
    docker push denied: requested access to the resource is denied
    HDU 3709 Balanced Number
    Ahoi2009 self 同类分布
    HDU 1711 Number Sequence
  • 原文地址:https://www.cnblogs.com/wujianqinjian/p/7771792.html
Copyright © 2020-2023  润新知