前提:已经安装好了python,还有requests,详见1、pycharm、python下载与安装
import requests
class TestCase:
def test1(self):
url = '**这里是接口的url地址**'
params = {"type": "json"}
resp = requests.get(url=url, params=params)
print(resp.json())
if __name__ == '__main__':
TestCase().test1()
备注:没有接口怎么办?我是从这个网站上copy的https://api.shanhe.kim/