python POST推送多种数据
python POST推送多种数据
import requests, os, json,hashlib from requests.exceptions import Timeout #小程序数据推送 def postDataToServer(self,param1,param2,param3,param4): url = 'http://www.baidu.com/t1/dfgdfgsdfgsdfgsdfbdfgsdgsdfgsdfgjfhjfgsdvasdas' files = {'fileImgs': (param2, open(param2, 'rb'), 'image/jpeg')} data = { 'param1': param1, 'param3':param3, 'param4':param4 } try: request_result = requests.post(url,files=files,data=data,timeout=5,verify=False) except requests.exceptions.HTTPError as e3: print(e3.response.text) except Timeout: print("请求超时,请检查网络") except requests.exceptions.RequestException as e6: print(f'请求出错:{e6}') #
###########################
QQ 3087438119