我想从我的api中的数组中获取单个对象。我该怎么做。
from urllib2 import Request, urlopen
headers = {
'Content-Type': 'application/json',
'X-Auth-App-Key': 'BvBdsGHQKc1dOOWGMcy0f07XXXXXXXXX0zv5zxHNDhf4P5NFElwKsZWWV3QceKq5J'
}
request = Request('https://XXXXXXt.com/api/v1.0/clients/123', headers=headers)
response_body = urlopen(request).read()
print response_body
响应:
{"id":123,
"isLead":false,
"clientType":1,
"contacts: [ {
"id":174,
"clientId":123,
"email":"mmayert@example.net",
"phone":"1-210-900-9283",
"name":null,
"isBilling":true,
"isContact":true,
"types":[
{"id":1,
"name":"Billing"},
{"id":2,"name":"General"}]}]**,
我有一个现有的API,我正在尝试使用Twilio创建一个Web应用程序以获取客户支持。当某个电话号码拨打时一个客户端,它会触发一个Web挂接(Web应用程序),并执行GET命令来检索具有该特定电话号码的客户端,以便它可以向他打招呼