设置类和函数如下:
class MM():
def ff(self,url(1),method(2),data=None(3),cookie=None(4)):
if method.lower()=="post":
res=requests.post(url,data,verify=False)
else:
res = requests.get(url, data,verify=False)
return res
调用函数:
if __name__ == '__main__':
url="https://XXX"
data={"email":"XXX","password":"XXX","remember":"0"}
res=MM().ff(url(1),method="post"(2),data=data(3))
#或者
res=MM().ff(url(1),data=data(3),method="post"(2))
#data必须赋值,不然报错
#报错内容为:ff() got multiple values for argument 'method'