以post方式获取接口相关信息
1 #! /usr/bin/env python 2 # coding=utf-8 3 import json 4 import urllib 5 import requests 6 import sys 7 reload(sys) 8 sys.setdefaultencoding(‘utf-8‘) 9 url = ‘http://xxx/api/17676‘ 10 requests_body = { 11 "access_token":"xxxx", 12 "request_body":{ 13 "organizationName":"xx", 14 "appImportance":2, 15 } 16 } 17 r =requests.post(url,json=requests_body) 18 data =r.content 19 data1 =json.loads(data) 20 locations = data1["data"] 21 print(data) 22 for location in locations: 23 appid = location["appId"] 24 chineseName = location["chineseName"] 25 appImportance = location["appImportance"] 26 owner = location["owner"] 27 inter= str(appid) + " " + str(chineseName) +" " + str(owner) + " " + str(appImportance) 28 print(inter)