forked from mtcontrib/minetest-u_skinsdb
StandardError -> Exception
Try to add some python codes [untested]
This commit is contained in:
parent
a4921558f3
commit
503b9a0125
@ -17,11 +17,13 @@ def addpage(page):
|
|||||||
try:
|
try:
|
||||||
c.request("GET", "/api/get.json.php?getlist&page=" + str(page) + "&outformat=base64")
|
c.request("GET", "/api/get.json.php?getlist&page=" + str(page) + "&outformat=base64")
|
||||||
r = c.getresponse()
|
r = c.getresponse()
|
||||||
except StandardError:
|
except Exception:
|
||||||
if r != 0:
|
if r != 0:
|
||||||
if r.status != 200:
|
if r.status != 200:
|
||||||
print("Error", r.status)
|
print("Error", r.status)
|
||||||
exit(r.status)
|
exit(r.status)
|
||||||
|
return
|
||||||
|
|
||||||
data = r.read().decode()
|
data = r.read().decode()
|
||||||
l = json.loads(data)
|
l = json.loads(data)
|
||||||
if not l["success"]:
|
if not l["success"]:
|
||||||
@ -41,11 +43,12 @@ def addpage(page):
|
|||||||
try:
|
try:
|
||||||
c.request("GET", "/skins/1/" + str(s["id"]) + ".png")
|
c.request("GET", "/skins/1/" + str(s["id"]) + ".png")
|
||||||
r = c.getresponse()
|
r = c.getresponse()
|
||||||
except StandardError:
|
except Exception:
|
||||||
if r != 0:
|
if r != 0:
|
||||||
if r.status != 200:
|
if r.status != 200:
|
||||||
print("Error", r.status)
|
print("Error", r.status)
|
||||||
exit(r.status)
|
continue
|
||||||
|
|
||||||
data = r.read()
|
data = r.read()
|
||||||
f = open(skinsdir + "character_" + str(i) + "_preview.png", "wb")
|
f = open(skinsdir + "character_" + str(i) + "_preview.png", "wb")
|
||||||
f.write(data)
|
f.write(data)
|
||||||
|
Loading…
Reference in New Issue
Block a user