tybug / ossapi

The definitive python wrapper for the osu! api.
https://tybug.github.io/ossapi/
GNU Affero General Public License v3.0
80 stars 17 forks source link

Missing cursor attribute `play_count` for beatmapsets search with sort query #37

Closed Techno-coder closed 3 years ago

Techno-coder commented 3 years ago

The cursor for the /beatmapsets/search/?sort=plays_desc endpoint (which I'm currently invoking directly) is missing the play_count attribute which causes the client to crash:

<class 'ossapi.models.BeatmapsetSearchResult'> cursor
{'play_count': '23628495', '_id': '219380'}
<class 'ossapi.models.Cursor'> play_count
<...>
    type_ = annotations[attr]
KeyError: 'play_count'

This PR adds the attribute. I'm not sure why it's a string instead of an integer but oh well.

tybug commented 3 years ago

Thanks.

I'm thinking that we actually get rid of cursor annotations entirely. The idea originally was to convert them to better types in case anybody wanted to access or manipulate them. But the osu team has since made it clear that cursors are part of an undocumented, internal api, so it's probably best we don't mess with them if it's going to cause issues like this. There are other concerns as well, like name collisions or the types changing in the future.

tybug commented 3 years ago

done in b8584f31ed1b0b94f080421e896ce7a4555d87a5, missing cursor annotations shouldn't be an issue anymore