hikyuu2/hikyuu/admin/service/config.py

29 lines
761 B
C++
Raw Normal View History

2021-04-30 01:47:34 +08:00
# -*- coding: utf-8 -*-
from PyQt5 import QtCore
2021-05-10 01:55:23 +08:00
server_api_config = {
"protocol": "http",
"prefix": "hku",
"version": "v1",
}
2021-04-30 01:47:34 +08:00
2021-05-16 02:03:33 +08:00
def getserviceUrl(host_url, port, service, api):
2021-05-10 01:55:23 +08:00
return "{}://{}:{}/{}/{}/{}/{}".format(
2021-05-16 02:03:33 +08:00
server_api_config["protocol"], host_url, port, server_api_config["prefix"], service,
server_api_config["version"], api
2021-04-30 01:47:34 +08:00
)
def defaultRequestHeader():
header = {
2021-04-30 01:47:34 +08:00
"Content-Type": "application/json",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0",
"Accept-Encoding": "gzip, deflate, br"
}
loc = QtCore.QLocale()
if loc.language() == QtCore.QLocale.Chinese:
header["Accept-Language"] = "zh_CN"
return header