def run_main(self, method, url, data=None, header=None):
res=None
if method=='POST':
self.post_main(self,url,data,header)
else:
self.get_main(self, url, data, header)
return res
调用如下:
def go_on_run(self):
res=None
rows_count=self.data.get_case_lines()
for i in range(1,rows_count):
url=self.data.get_url(i)
method=self.data.get_request_method(i)
header=self.data.get_request_header(i)
is_run=self.data.get_is_run(i)
data=self.data.get_data_for_json(i)
print(“第%s 次打印” %(i))
print(method)
print(url)
print(data)
print(header)
print(is_run)
if is_run:
res= self.run_method.run_main(method, url, data, header)
return res
TypeError: get_main() takes from 2 to 4 positional arguments but 5 were given
第1 次打印
Post
https://m.imooc.com/passport/user/login
{‘username’: ‘18513199586’, ‘password’: ‘111111’, ‘verify’: ‘’, ‘referer’: ‘http://m.imooc.com’}
None
是否运行:True