楔子

现在, 要测试这些接口:

"""
用例集
case_set.py
pip install requests
"""
import requests

def v2ex_info():
    """
    获取v2ex的网站信息
    https://www.v2ex.com/api/site/info.json

    """
    response = requests.get(url='https://www.v2ex.com/api/site/info.json')
    return response.json().get('title')  # V2EX

def v2ex_stats():
    """
    获取v2ex的网站信息
    https://www.v2ex.com/api/site/stats.json
    """
    response = requests.get(url='https://www.v2ex.com/api/site/stats.json')
    return response.json().get('member_max')  # int类型

def cnodejs():
    """ 获取 cnodejs,推荐博客总数 """
    response = requests.get('https://cnodejs.org/api/v1/topics')
    return response.json().get('success')  # True

if __name__ == '__main__':
    print(v2ex_info() == 'V2EX')
    print(type(v2ex_stats()) is int)
    print(cnodejs() is True)
View Code

相关文章:

  • 2021-11-29
  • 2021-11-05
  • 2021-10-12
  • 2021-10-01
  • 2022-01-09
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-26
  • 2021-03-30
  • 2021-09-14
  • 2022-01-05
相关资源
相似解决方案