-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgetManifest.py
More file actions
27 lines (21 loc) · 852 Bytes
/
getManifest.py
File metadata and controls
27 lines (21 loc) · 852 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import requests
from log import logger
from manifest import getManifestOnline
BungieJSONFilePath = "./data/BungieManifest/"
def downloadManifest(languages: list = ["zh-chs", "en"]) -> None:
manifestInfo = getManifestOnline()
version = manifestInfo["version"]
logger.success(f"Manifest version: {version}")
jsonWorldContentPaths = manifestInfo["jsonWorldContentPaths"]
for language in languages:
url = jsonWorldContentPaths[language]
with requests.Session() as session:
response = session.get(url="https://www.bungie.net" + url)
data = response.content
with open(BungieJSONFilePath + f"BungieJSON_{language}.json", "wb") as f:
f.write(data)
logger.success(f"Downloaded {language} manifest")
try:
downloadManifest()
except Exception as e:
print(e)