python 学习之调用web api
import urllibimport json
url = 'http://xxx.xxx.xxx.xxx:8888/xxxx-api/customer/qq/channels'
def get_data():
response = urllib.urlopen(url).read()
json_array = json.loads(response)
channel = {}
for json_map in json_array:
channel] = json_map['name']
return channel;
if __name__ == '__main__':
clist = get_data()
for key in clist.keys():
print("%s %s") % (key, clist)
页:
[1]