1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

fix stuff

This commit is contained in:
Steffo 2020-08-30 19:00:31 +02:00
parent 2f358b2e70
commit 14f7a0e7f9
5 changed files with 7 additions and 7 deletions

View file

@ -2,7 +2,7 @@
[tool.poetry] [tool.poetry]
name = "royalpack" name = "royalpack"
version = "5.14.7" version = "5.14.8"
description = "A Royalnet command pack for the Royal Games community" description = "A Royalnet command pack for the Royal Games community"
authors = ["Stefano Pigozzi <ste.pigozzi@gmail.com>"] authors = ["Stefano Pigozzi <ste.pigozzi@gmail.com>"]
license = "AGPL-3.0+" license = "AGPL-3.0+"

View file

@ -61,7 +61,7 @@ class OsuCommand(LinkerCommand):
async with aiohttp.ClientSession(headers={"Authorization": f"Bearer {obj.access_token}"}) as session: async with aiohttp.ClientSession(headers={"Authorization": f"Bearer {obj.access_token}"}) as session:
async with session.get("https://osu.ppy.sh/api/v2/me/osu") as response: async with session.get("https://osu.ppy.sh/api/v2/me/osu") as response:
m = await response.json() m = await response.json()
obj.avatar_url = m["avatar_url"] obj.avatar_url = m.get("avatar_url")
obj.username = m["username"] obj.username = m["username"]
if "statistics" in m: if "statistics" in m:
await change("standard_pp", m["statistics"].get("pp")) await change("standard_pp", m["statistics"].get("pp"))

View file

@ -66,7 +66,7 @@ class Osu(Updatable):
client_secret=client_secret, client_secret=client_secret,
refresh_code=self.refresh_token) refresh_code=self.refresh_token)
self.access_token = j["access_token"] self.access_token = j["access_token"]
self.refresh_token = j["refresh_token"] self.refresh_token = j.get("refresh_token") or self.refresh_token
self.expiration_date = datetime.datetime.now() + datetime.timedelta(seconds=j["expires_in"]) self.expiration_date = datetime.datetime.now() + datetime.timedelta(seconds=j["expires_in"])
async def refresh_if_expired(self, *, client_id, client_secret): async def refresh_if_expired(self, *, client_id, client_secret):

View file

@ -19,7 +19,7 @@ async def oauth_refresh(*, url, client_id, client_secret, refresh_code):
async with session.post(url, data={ async with session.post(url, data={
"client_id": client_id, "client_id": client_id,
"client_secret": client_secret, "client_secret": client_secret,
"code": refresh_code, "refresh_token": refresh_code,
"grant_type": "refresh_token" "grant_type": "refresh_token"
}) as response: }) as response:
j = await response.json() j = await response.json()