忘记了请求模块,如果需要用到除post、get请求之外的请求方式直接照例定义到Methord类下
1 import requests 2 import json 3 4 class Methord(): 5 def runMethord(self,methord,url,data=None,headers=None): 6 res = None 7 if headers != None: 8 if methord == "post": 9 res = requests.post(url,data,headers=headers) 10 elif methord == "get": 11 res = requests.get(url,data,headers=headers) 12 else: 13 if methord == "post": 14 res = requests.post(url,data) 15 elif methord == "get": 16 res = requests.get(url,data) 17 return res