Commit acf77ebe authored by 邓莹莹's avatar 邓莹莹

增加日志,记录status,time

parent 5c6567aa
import json
import random
import string
import datetime
import requests
import yaml
import os
......@@ -74,6 +74,7 @@ class BaseRequest:
# if req.get('isLogin'):
# s = LoginFunction().get_session()
# 调用具体case的url
print("请求开始时间:",datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f"))
r = requests.request(
req['method'],
url=url_host + req['url'],
......@@ -85,14 +86,19 @@ class BaseRequest:
# proxies={"http":"172.30.9.226:8888"}
)
print("请求结束时间:",datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f"))
try:
content_type = r.headers.get("content-type").split(";")[0]
except:
content_type = "application/json"
if content_type == 'application/json':
print("请求结果验证码***",r.status_code)
print("请求request数据",r.request)
print("请求的headers数据",r.headers)
return r.json()
print("请求结果验证码***", r.status_code)
print("请求request数据", r.request)
print("请求的headers数据", r.headers)
return r.text
def get_cookie(self, req: dict):
......
_gtid=add2928a03f811ecbb4dca44d4790cf29387;sessionid=nzz8aourtz4q3et01effi7ovggch4qc2
\ No newline at end of file
_gtid=9025f29e058e11ec9fb57e560ecdb5bc804;sessionid=cjmm2op613qiesltkxnye2pf4lqcj9ny
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment