Closed the-wildguy closed 8 months ago
fixed things that return error:None by ignoring when there is no error
{"error": None}
doesn't mean there is no error, just that osu-web has not provided a description for the error.
also fixed when there is no user score on a map by returning None type if there is no score
can you provide an example of when this happens? if this is an issue, it should be fixed by making a field optional, rather than hardcoding logic in the deserialization code.
For the second part of you did self.beatmap_user_score on a map a user didn't have a score on than you would get a value error saying nonetype did not have a field perfect.
For the first part, just believe that it has no error. Unless you can find an example of an error none where there should be an error, in which case you should report it to the Osu-API GitHub so they can fix it.
Unless you can find an example of an error none where there should be an error,
I guarantee these exist. e.g. requesting nonexistent users.
of you did self.beatmap_user_score on a map a user didn't have a score on than you would get a value error saying nonetype did not have a field perfect.
can you provide a specific user and beatmap that reproduces this error?
Requesting non existent users shouldn't be an error it should just return that there is no error and include no user info, plus if you think that that is an error you should report it on the osu API GitHub
Also https://osu.ppy.sh/scores/2508384914 this map with this user https://osu.ppy.sh/users/22691179
This is the map https://osu.ppy.sh/beatmapsets/2063427#mania/4471870
Requesting non existent users shouldn't be an error
Disagree. It's the consumer's responsibility to explicitly handle this case by try/catching.
I get the following for the user/beatmap pair you provided:
>>> api.beatmap_user_score(4471870, 22691179)
ValueError: api returned an error of `None` for a request to https://osu.ppy.sh/api/v2/beatmaps/4471870/scores/users/22691179
which is correct since the score doesn't exist. If you can reproduce an issue related to attributes that isn't expected behavior, I'd be happy to fix it, but I'm going to close this as working as intended.
That's the wrong id for that map
Also when I did a try except it didn't work it still had the error and didn't quit
fixed things that return error:None by ignoring when there is no error
also fixed when there is no user score on a map by returning None type if there is no score