1234567891011121314151617181920212223 |
- # 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
- # if __name__ == '__main__':
- # httputil = HttpRequestsUtil()
- # httputil.postText()
- # HttpUtil.postText()
|