def get_version(): logger.info("getting production version") data = http_client.get(None, VERSION_URL) if data is None: return config.ProductionConfig.clientVersion = data["clientVersion"] config.ProductionConfig.assetsVersion = data["resVersion"] logger.info("finish") return data["resVersion"], data["clientVersion"]
def data_updater(datafile): logger.info("updating {}".format(datafile)) data = http_client.get(None, GAME_DATA_URL.format(datafile)) if data is None: logger.error("updating {} fail".format(datafile)) return with open(get_resource_path(datafile), "w", encoding="utf-8") as f: f.write(json.dumps(data, indent=2, ensure_ascii=False)) logger.info("success") return data
def update_stage_table(): logger.info("updating stage table") data = http_client.get(None, STAGE_TABLE_URL) if data is None: logger.error("updating stage table fail") return with open(get_resource_path("stage_table.json"), "w", encoding="utf-8") as f: f.write(json.dumps(data, indent=2, ensure_ascii=False)) logger.info("success") return data
def get_network(config_server_name): logger.info("getting network version") data = http_client.get(None, NETWORK_CONFIG_URL.format(config_server_name)) if data is None: return json_data = json.loads(data["content"]) config.NetworkConfig.version = json_data["configVer"] config.NetworkConfig.network = json_data["configs"][ json_data["funcVer"]]["network"] config.NetworkConfig.update_server_url() logger.info("finish") return json_data