class API:
api_root = "https://api.helldivers2.dev"
headers = {
"Accept": "application/json",
"Accept-Language": "zh-Hans",
"User-Agent": "SherkeyXD/helldivers-2-api-python",
"X-Super-Client": "writing.prts.tech",
}
@staticmethod
def __makeRequest(url: str, max_retry: int = 3):
for _ in range(max_retry):
res = requests.get(url, headers=API.headers)
if res.status_code == 200:
return res.json()
return None
@staticmethod
def GetApiV1Planets(index : int) -> dict:
"""
Fetches a specific Planet identified by index.
"""
info = API.__makeRequest(API.api_root + f"/api/v1/planets/{index}")
return info
Steps to reproduce
Set "Accept-Language": "zh-Hans" in header, then request.
What is expected?
All info should be in Chinese.
What is actually happening?
Only planet name is in Chinese, other infos are still in English.
{
"index": 79,
"name": "希斯",
"sector": "Orion",
"biome": {
"name": "Winter", // Should be in Chinese
"description": "Submerged in eternal winter, this world's frosty peaks glimmer in the light of its too-distant star." // Should be in Chinese
},
"hazards": [
{
"name": "Extreme Cold", // Should be in Chinese
"description": "Icy temperatures reduce rate of fire and delay heat buildup in weapons." // Should be in Chinese
},
{
"name": "Blizzards", // Should be in Chinese
"description": "Intense blizzard reduce mobility and moderately reduce visibility for both enemy and friendly units." // Should be in Chinese
}
],
// ...
}
System Info
No response
Any additional comments?
Not only zh-Hans meets this problem, all languages are experiencing this.
Link to faulty endpoint
/api/v1/planets
The name of your client/application
SherkeyXD/helldivers-2-api-python
Request information
Steps to reproduce
Set
"Accept-Language": "zh-Hans"
in header, then request.What is expected?
All info should be in Chinese.
What is actually happening?
Only planet name is in Chinese, other infos are still in English.
System Info
No response
Any additional comments?
Not only
zh-Hans
meets this problem, all languages are experiencing this.