2021-04-30 01:47:34 +08:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2021-05-03 02:01:47 +08:00
|
|
|
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():
|
2021-05-03 02:01:47 +08:00
|
|
|
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"
|
|
|
|
}
|
2021-05-03 02:01:47 +08:00
|
|
|
loc = QtCore.QLocale()
|
|
|
|
if loc.language() == QtCore.QLocale.Chinese:
|
|
|
|
header["Accept-Language"] = "zh_CN"
|
|
|
|
return header
|