Commit 7fa61ca1 authored by Wallen姚文辉's avatar Wallen姚文辉

修复bug

parent 0f9cf91b
......@@ -9,6 +9,7 @@ from jenkins import Jenkins
config=get_config()
mysqlConf=config["mysql"]
Jenkinsconf=config["jenkins"]
class server():
app = Flask(__name__, template_folder='auto_test/html', static_folder='')
......@@ -20,7 +21,9 @@ class server():
db = SQLAlchemy(app)
socketio = SocketIO()
socketio.init_app(app, cors_allowed_origins='*')
auto_jenkins=Jenkins('http://192.168.11.185:8080/',"admin0001","123456")
auto_jenkins=Jenkins(Jenkinsconf["address"],Jenkinsconf["user"],Jenkinsconf["password"])
......
import requests
import time
apifox_token=None
def updateapitoken():
user,password='wallen.ywh@galaxyoversea.com','ywh940509'
global apifox_token
apifox_token=requests.post('https://api.apifox.com/api/v1/login?locale=zh-CN',json={"account":user,"loginType":"EmailPassword","password":password}).json().get("data").get("accessToken")
def a():
url='https://app.apifox.com/project/2581365/api-test/test-report/5095032'
global apifox_token
apifox_token or updateapitoken()
infolist=url.replace("https://app.apifox.com/project/","").split('/')
project_id,caseid=infolist[0],infolist[-1]
result=requests.get(f"https://api.apifox.com/api/v1/projects/{project_id}/api-test-reports/{caseid}?locale=zh-CN",headers={"Authorization":apifox_token}).json()
changeTime=lambda x:time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(float(x)/1000))
result['data']['timings']["completed"]=changeTime(result['data']['timings']["completed"])
result['data']['timings']["started"]=changeTime(result['data']['timings']["started"])
result['url']=url
return result
q=' jhoiqwhe '
q=q.strip()
print(q)
\ 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