khazhyk / osuapi

Simple osu api wrapper that I can use with both requests and aiohttp
http://osuapi.readthedocs.io/en/latest/index.html
MIT License
16 stars 8 forks source link

Properly convert Score.perfect to bool #17

Closed christopher-dG closed 6 years ago

christopher-dG commented 6 years ago

Bug:

>>> scores = api.get_scores(beatmap_id=129891, username='cookiezi')
>>> scores[1].score_id, scores[1].countmiss, scores[1].perfect
(2266240534, 1, True)
>>> scores = requests.get("https://osu.ppy.sh/api/get_scores?k=%s&u=cookiezi&b=129891" % os.environ["OSU_API_KEY"]).json()
>>> scores[1]["score_id"], scores[1]["countmiss"], scores[1]["perfect"]
('2266240534', '1', '0')

Reason:

>>> bool("0")
True

As an aside, this code is really easy to work with :smile:

khazhyk commented 6 years ago

Thanks! It looks like the other places that use bool need this too... I'll probably do that before pushing this to a release