import requests
#请求地址
url = "https://api.global.net/datastore/v1/tracks/"+trackId+"?location=12}"
#发送get请求
r = requests.get(url)
#获取返回的json数据
print(r.json())
import json
import requests
from django.conf.urls import url
from django.test import TestCase
# Create your tests here.
url = "http://10.37.*.*:8080/zwzx/api/v1/get/pons/custid/?custid=39008781920"
r = requests.get(url)
print(r.json())
print(type(r.json()))
# <class 'dict'>
strdata = json.dumps(r.json())
print(strdata)
print(type(strdata))
# <class 'str'>
liststr = r.json()['data']
print(liststr)
print(type(liststr))
# <class 'list'>
dictdata = r.json()['data'][0]
print(dictdata)
print(type(dictdata))
# <class 'dict'>
print(dictdata['sn'])
for table in liststr:
print(table['sn'])
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/543e602f41fba1e8403ba32313a7d1c7.png)