Skip to content

Commit

Permalink
fix: requests hardcore mode pre-patch
Browse files Browse the repository at this point in the history
  • Loading branch information
MalikAza committed Jul 27, 2024
1 parent abf9c92 commit 0b6cf26
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pyZUnivers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@

API_BASE_URL = "https://zunivers-api.zerator.com/public"
PLAYER_BASE_URL = "https://zunivers.zerator.com/joueur"
ZU_HEADER = {
"X-ZUnivers-RuleSetType": "NORMAL",
}

DATE_FORMAT = '%Y-%m-%d'
DATE_TIME_FORMAT = "%Y-%m-%dT%H:%M:%S"
FULL_DATE_TIME_FORMAT = f"{DATE_TIME_FORMAT}.%f"
Expand Down Expand Up @@ -73,7 +77,7 @@ def get_datas(url) -> List | Dict:
ZUniversAPIError: If there is an error decoding the JSON response.
"""
with requests.get(url) as resp:
with requests.get(url, headers=ZU_HEADER) as resp:
if resp.status_code == 404: return []

try:
Expand All @@ -99,7 +103,7 @@ def post_datas(url) -> List | Dict:
Exception: If there is any other exception during the request.
"""
with requests.post(url) as resp:
with requests.post(url, headers=ZU_HEADER) as resp:
try:
datas = resp.json()
except Exception as e:
Expand Down

0 comments on commit 0b6cf26

Please sign in to comment.