catch graphql query errors with a nice message

This commit is contained in:
eli fessler
2023-05-31 04:38:02 -10:00
parent b311e90c8a
commit 6bac1be5dc

4
s3s.py
View File

@@ -255,6 +255,10 @@ def fetch_json(which, separate=False, exportall=False, specific=False, numbers_o
query1_resp = json.loads(query1.text)
swim()
if not query1_resp.get("data"): # catch error
print("\nSomething's wrong with one of the query hashes. Ensure s3s is up-to-date, and if this message persists, please open an issue on GitHub.")
sys.exit(1)
# ink battles - latest 50 of any type
if "latestBattleHistories" in query1_resp["data"]:
for battle_group in query1_resp["data"]["latestBattleHistories"]["historyGroups"]["nodes"]: