12345678910111213141516171819202122232425262728293031 |
- # coding=utf-8
- import requests
- import json
- class HttpRequestsUtil(object):
- #post方法获取数据 application/json
- @staticmethod
- def post(url, postData,headers): #
- data = json.dumps(postData)
- response = requests.request("POST",url, data=data.encode('utf-8'),
- headers=headers)
- res = response.json()
- return res
- @staticmethod
- def get(url,getData): #
- response = requests.request("GET",url+getData)
- res = response.json()
- # print(res)
- return res
- if __name__ == '__main__':
- httputil = HttpRequestsUtil()
- # httputil.postText()
- # HttpUtil.postText()
- # httputil.get("http://web.sagacloud.cn:8008/sgdaping/duoduo-service/setup-service/environment/queryConditionerStatus?projectId=","Pj1101010007")
|