调整
This commit is contained in:
parent
46360a383b
commit
f92937fba6
27
main.py
27
main.py
@ -21,15 +21,28 @@ def console_listener(tab):
|
|||||||
|
|
||||||
def network_listener(tab):
|
def network_listener(tab):
|
||||||
# 监听网络
|
# 监听网络
|
||||||
tab.listen.start(targets="192.168.31.139:8126")
|
tab.listen.start(targets=["/api/"])
|
||||||
for log in tab.listen.steps():
|
for log in tab.listen.steps():
|
||||||
try:
|
try:
|
||||||
# print("[network.log]", log)
|
print("=" * 50)
|
||||||
print(vars(log))
|
|
||||||
# request = json.dumps(log.request)
|
|
||||||
# print(request)
|
|
||||||
# response = json.dumps(log.response)
|
|
||||||
print(f"[network.log] {log.method} {log.url} {'request'} {''}")
|
print(f"[network.log] {log.method} {log.url} {'request'} {''}")
|
||||||
|
print("=" * 50 + '\t' + "request")
|
||||||
|
print("=" * 50 + '\t' + "request.headers")
|
||||||
|
for key in log.request.headers.keys():
|
||||||
|
print(key, log.request.headers[key])
|
||||||
|
|
||||||
|
reqType = log.request.headers['Content-Type']
|
||||||
|
if reqType == 'application/json':
|
||||||
|
print("=" * 50 + '\t' + "request.body")
|
||||||
|
print(json.dumps(log.request.body, indent=4))
|
||||||
|
print(vars(log.request))
|
||||||
|
|
||||||
|
respType = log.response.headers['Content-Type']
|
||||||
|
if respType == 'application/json':
|
||||||
|
print("=" * 50 + '\t' + "response.body")
|
||||||
|
print(json.dumps(log.response.body, indent=4))
|
||||||
|
|
||||||
|
print(vars(log.response))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
|
||||||
@ -37,7 +50,7 @@ executor = ThreadPoolExecutor(max_workers=2)
|
|||||||
executor.submit(console_listener, tab)
|
executor.submit(console_listener, tab)
|
||||||
executor.submit(network_listener, tab)
|
executor.submit(network_listener, tab)
|
||||||
|
|
||||||
tab.get(url='http://127.0.0.1:8080/pages/index/shopIndex')
|
tab.get(url='http://127.0.0.1:24613')
|
||||||
tab.change_mode()
|
tab.change_mode()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user