mirror of
https://github.com/Emersont1/itchio.git
synced 2026-03-11 08:54:39 +00:00
Use the json() method of the requests library (#85)
This commit is contained in:
parent
7cec2f24a2
commit
be67f4e42d
2 changed files with 4 additions and 6 deletions
|
|
@ -1,4 +1,3 @@
|
|||
import json
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
import functools
|
||||
import threading
|
||||
|
|
@ -24,7 +23,7 @@ class Library:
|
|||
f"https://api.itch.io/profile/owned-keys?page={page}",
|
||||
headers={"Authorization": self.login},
|
||||
)
|
||||
j = json.loads(r.text)
|
||||
j = r.json()
|
||||
|
||||
for s in j["owned_keys"]:
|
||||
self.games.append(Game(s))
|
||||
|
|
@ -46,7 +45,7 @@ class Library:
|
|||
f"https://{publisher}.itch.io/{title}/data.json",
|
||||
headers={"Authorization": self.login},
|
||||
)
|
||||
j = json.loads(rsp.text)
|
||||
j = rsp.json()
|
||||
game_id = j["id"]
|
||||
gsp = requests.get(
|
||||
f"https://api.itch.io/games/{game_id}/uploads",
|
||||
|
|
@ -84,7 +83,7 @@ class Library:
|
|||
f"https://api.itch.io/games/{game_id}",
|
||||
headers={"Authorization": self.login},
|
||||
)
|
||||
k = json.loads(gsp.text)
|
||||
k = gsp.json()
|
||||
self.games.append(Game(k))
|
||||
|
||||
def download_library(self, platform=None):
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import json
|
||||
from bs4 import BeautifulSoup as soup
|
||||
import requests
|
||||
|
||||
|
|
@ -41,7 +40,7 @@ def LoginAPI(user, password):
|
|||
print(warning)
|
||||
print(r.text)
|
||||
raise RuntimeError
|
||||
t = json.loads(r.text)
|
||||
t = r.json()
|
||||
|
||||
if not t["success"]:
|
||||
print("Error: success key is not true")
|
||||
|
|
|
|||
Loading…
Reference in a new issue