需求
1. 请求参数不同
2. 分别请求同一个url
3. 比较两次请求后的响应
4. 获取差异值
代码
diff.py
def diff_text(text1, text2):
diff = ""
for line in text1.split("\n"):
if not line in text2:
diff += line + "\n"
return diff
def requester(method, param):
if method == "POST":
r = requests.post()
elif method == "GET":
r = requests.get()
return r
r1 = requester("post", "")
r2 = requester("post", "payload")
diff = diff_text(r1.text, r2.text)
print(diff)