mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-27 13:34:28 +00:00
Aggiunto controllo degli errori
This commit is contained in:
parent
f29e6e7b40
commit
7c5b50359d
1 changed files with 12 additions and 3 deletions
9
osu.py
9
osu.py
|
@ -14,7 +14,10 @@ def getbeatmap(num):
|
|||
'b': num,
|
||||
}
|
||||
r = requests.get("https://osu.ppy.sh/api/get_beatmaps", params=parametri).json()
|
||||
if len(r) >= 1:
|
||||
return r[0]
|
||||
else:
|
||||
raise NameError
|
||||
|
||||
|
||||
def getuser(user, mode=0):
|
||||
|
@ -28,7 +31,10 @@ def getuser(user, mode=0):
|
|||
'm': mode
|
||||
}
|
||||
r = requests.get("https://osu.ppy.sh/api/get_user", params=parametri).json()
|
||||
if len(r) >= 1:
|
||||
return r[0]
|
||||
else:
|
||||
raise NameError
|
||||
|
||||
|
||||
def getscores(beatmap, mode=0, limit=100, user=None):
|
||||
|
@ -75,4 +81,7 @@ def getuserrecent(user, mode=0):
|
|||
'limit': 1,
|
||||
}
|
||||
r = requests.get("https://osu.ppy.sh/api/get_user_recent", params=parametri).json()
|
||||
if len(r) >= 1:
|
||||
return r[0]
|
||||
else:
|
||||
raise NameError
|
||||
|
|
Loading…
Reference in a new issue