Попытка фикса кодировки dt
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "osuclient"
|
name = "osuclient"
|
||||||
version = "0.5.3"
|
version = "0.5.4"
|
||||||
description = "Client for osu! API"
|
description = "Client for osu! API"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = [
|
authors = [
|
||||||
|
|||||||
@ -24,24 +24,25 @@ class UserToken(Token):
|
|||||||
refresh_token: str
|
refresh_token: str
|
||||||
|
|
||||||
|
|
||||||
class Country(BaseModel):
|
class CustomModel(BaseModel):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
model_config = ConfigDict(
|
||||||
|
extra='forbid',
|
||||||
|
json_encoders={datetime: lambda dt: dt.isoformat() if dt else None},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class Country(CustomModel):
|
||||||
code: str
|
code: str
|
||||||
name: str
|
name: str
|
||||||
|
|
||||||
|
|
||||||
class Cover(BaseModel):
|
class Cover(CustomModel):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
custom_url: str | None
|
custom_url: str | None
|
||||||
url: str
|
url: str
|
||||||
id: int | None
|
id: int | None
|
||||||
|
|
||||||
|
|
||||||
class DailyChallengeUserStats(BaseModel):
|
class DailyChallengeUserStats(CustomModel):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
daily_streak_best: int
|
daily_streak_best: int
|
||||||
daily_streak_current: int
|
daily_streak_current: int
|
||||||
last_update: str
|
last_update: str
|
||||||
@ -54,51 +55,37 @@ class DailyChallengeUserStats(BaseModel):
|
|||||||
weekly_streak_current: int
|
weekly_streak_current: int
|
||||||
|
|
||||||
|
|
||||||
class MonthlyPlaycount(BaseModel):
|
class MonthlyPlaycount(CustomModel):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
start_date: str
|
start_date: str
|
||||||
count: int
|
count: int
|
||||||
|
|
||||||
|
|
||||||
class Page(BaseModel):
|
class Page(CustomModel):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
html: str
|
html: str
|
||||||
raw: str
|
raw: str
|
||||||
|
|
||||||
|
|
||||||
class RankHighest(BaseModel):
|
class RankHighest(CustomModel):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
rank: int
|
rank: int
|
||||||
updated_at: str
|
updated_at: str
|
||||||
|
|
||||||
|
|
||||||
class Kudosu(BaseModel):
|
class Kudosu(CustomModel):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
available: int
|
available: int
|
||||||
total: int
|
total: int
|
||||||
|
|
||||||
|
|
||||||
class ReplaysWatchedCount(BaseModel):
|
class ReplaysWatchedCount(CustomModel):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
start_date: str
|
start_date: str
|
||||||
count: int
|
count: int
|
||||||
|
|
||||||
|
|
||||||
class Level(BaseModel):
|
class Level(CustomModel):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
current: int
|
current: int
|
||||||
progress: int
|
progress: int
|
||||||
|
|
||||||
|
|
||||||
class GradeCounts(BaseModel):
|
class GradeCounts(CustomModel):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
ss: int
|
ss: int
|
||||||
ssh: int
|
ssh: int
|
||||||
s: int
|
s: int
|
||||||
@ -106,15 +93,11 @@ class GradeCounts(BaseModel):
|
|||||||
a: int
|
a: int
|
||||||
|
|
||||||
|
|
||||||
class Rank(BaseModel):
|
class Rank(CustomModel):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
country: int
|
country: int
|
||||||
|
|
||||||
|
|
||||||
class UserStatistics(BaseModel):
|
class UserStatistics(CustomModel):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
count_100: int
|
count_100: int
|
||||||
count_300: int
|
count_300: int
|
||||||
count_50: int
|
count_50: int
|
||||||
@ -139,32 +122,24 @@ class UserStatistics(BaseModel):
|
|||||||
rank: Rank
|
rank: Rank
|
||||||
|
|
||||||
|
|
||||||
class UserAchievement(BaseModel):
|
class UserAchievement(CustomModel):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
achieved_at: str
|
achieved_at: str
|
||||||
achievement_id: int
|
achievement_id: int
|
||||||
|
|
||||||
|
|
||||||
class RankHistory(BaseModel):
|
class RankHistory(CustomModel):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
mode: Literal['osu', 'taiko', 'fruits', 'mania']
|
mode: Literal['osu', 'taiko', 'fruits', 'mania']
|
||||||
data: list[int]
|
data: list[int]
|
||||||
|
|
||||||
|
|
||||||
class ActiveTournamentBanner(BaseModel):
|
class ActiveTournamentBanner(CustomModel):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
id: int
|
id: int
|
||||||
tournament_id: int
|
tournament_id: int
|
||||||
image: str
|
image: str
|
||||||
image_2x: str = Field(alias='image@2x')
|
image_2x: str = Field(alias='image@2x')
|
||||||
|
|
||||||
|
|
||||||
class Badge(BaseModel):
|
class Badge(CustomModel):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
awarded_at: datetime
|
awarded_at: datetime
|
||||||
description: str
|
description: str
|
||||||
image_2x_url: str = Field(alias='image@2x_url')
|
image_2x_url: str = Field(alias='image@2x_url')
|
||||||
@ -172,18 +147,14 @@ class Badge(BaseModel):
|
|||||||
url: str
|
url: str
|
||||||
|
|
||||||
|
|
||||||
class Team(BaseModel):
|
class Team(CustomModel):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
id: int
|
id: int
|
||||||
name: str
|
name: str
|
||||||
short_name: str
|
short_name: str
|
||||||
flag_url: str
|
flag_url: str
|
||||||
|
|
||||||
|
|
||||||
class ScoreStatistics(BaseModel):
|
class ScoreStatistics(CustomModel):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
count_100: int
|
count_100: int
|
||||||
count_300: int
|
count_300: int
|
||||||
count_50: int
|
count_50: int
|
||||||
@ -192,15 +163,11 @@ class ScoreStatistics(BaseModel):
|
|||||||
count_miss: int
|
count_miss: int
|
||||||
|
|
||||||
|
|
||||||
class CurrentUserAttributes(BaseModel):
|
class CurrentUserAttributes(CustomModel):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
pin: None
|
pin: None
|
||||||
|
|
||||||
|
|
||||||
class Covers(BaseModel):
|
class Covers(CustomModel):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
cover: str
|
cover: str
|
||||||
cover_2x: str = Field(..., alias='cover@2x')
|
cover_2x: str = Field(..., alias='cover@2x')
|
||||||
card: str
|
card: str
|
||||||
@ -211,9 +178,7 @@ class Covers(BaseModel):
|
|||||||
slimcover_2x: str = Field(..., alias='slimcover@2x')
|
slimcover_2x: str = Field(..., alias='slimcover@2x')
|
||||||
|
|
||||||
|
|
||||||
class Beatmapset(BaseModel):
|
class Beatmapset(CustomModel):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
anime_cover: bool
|
anime_cover: bool
|
||||||
artist: str
|
artist: str
|
||||||
artist_unicode: str
|
artist_unicode: str
|
||||||
@ -238,9 +203,7 @@ class Beatmapset(BaseModel):
|
|||||||
video: bool
|
video: bool
|
||||||
|
|
||||||
|
|
||||||
class User(BaseModel):
|
class User(CustomModel):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
avatar_url: str
|
avatar_url: str
|
||||||
country_code: str
|
country_code: str
|
||||||
default_group: str
|
default_group: str
|
||||||
@ -260,38 +223,28 @@ class User(BaseModel):
|
|||||||
groups: list[str] | None = None
|
groups: list[str] | None = None
|
||||||
|
|
||||||
|
|
||||||
class Weight(BaseModel):
|
class Weight(CustomModel):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
percentage: float
|
percentage: float
|
||||||
pp: float
|
pp: float
|
||||||
|
|
||||||
|
|
||||||
class BeatmapsetAvailability(BaseModel):
|
class BeatmapsetAvailability(CustomModel):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
download_disabled: bool
|
download_disabled: bool
|
||||||
more_information: str | None
|
more_information: str | None
|
||||||
|
|
||||||
|
|
||||||
class BeatmapsetNominationsSummaryRequiredMeta(BaseModel):
|
class BeatmapsetNominationsSummaryRequiredMeta(CustomModel):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
main_ruleset: int
|
main_ruleset: int
|
||||||
non_main_ruleset: int
|
non_main_ruleset: int
|
||||||
|
|
||||||
|
|
||||||
class BeatmapsetNominationsSummary(BaseModel):
|
class BeatmapsetNominationsSummary(CustomModel):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
current: int
|
current: int
|
||||||
eligible_main_rulesets: list[str]
|
eligible_main_rulesets: list[str]
|
||||||
required_meta: BeatmapsetNominationsSummaryRequiredMeta
|
required_meta: BeatmapsetNominationsSummaryRequiredMeta
|
||||||
|
|
||||||
|
|
||||||
class BeatmapsetExtended(Beatmapset):
|
class BeatmapsetExtended(Beatmapset):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
bpm: float
|
bpm: float
|
||||||
can_be_hyped: bool
|
can_be_hyped: bool
|
||||||
deleted_at: datetime | None
|
deleted_at: datetime | None
|
||||||
@ -311,23 +264,17 @@ class BeatmapsetExtended(Beatmapset):
|
|||||||
nominations_summary: BeatmapsetNominationsSummary
|
nominations_summary: BeatmapsetNominationsSummary
|
||||||
|
|
||||||
|
|
||||||
class BeatmapOwner(BaseModel):
|
class BeatmapOwner(CustomModel):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
id: int
|
id: int
|
||||||
username: str
|
username: str
|
||||||
|
|
||||||
|
|
||||||
class BeatmapFailtimes(BaseModel):
|
class BeatmapFailtimes(CustomModel):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
fail: list[int]
|
fail: list[int]
|
||||||
exit: list[int]
|
exit: list[int]
|
||||||
|
|
||||||
|
|
||||||
class Beatmap(BaseModel):
|
class Beatmap(CustomModel):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
beatmapset_id: int
|
beatmapset_id: int
|
||||||
difficulty_rating: float
|
difficulty_rating: float
|
||||||
id: int
|
id: int
|
||||||
@ -361,8 +308,6 @@ class Beatmap(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
class BeatmapExtended(Beatmap):
|
class BeatmapExtended(Beatmap):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
beatmapset: BeatmapsetExtended
|
beatmapset: BeatmapsetExtended
|
||||||
max_combo: int # type: ignore
|
max_combo: int # type: ignore
|
||||||
current_user_playcount: int
|
current_user_playcount: int
|
||||||
@ -370,9 +315,7 @@ class BeatmapExtended(Beatmap):
|
|||||||
failtimes: BeatmapFailtimes
|
failtimes: BeatmapFailtimes
|
||||||
|
|
||||||
|
|
||||||
class Score(BaseModel):
|
class Score(CustomModel):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
accuracy: float
|
accuracy: float
|
||||||
best_id: int | None
|
best_id: int | None
|
||||||
created_at: str
|
created_at: str
|
||||||
@ -399,8 +342,6 @@ class Score(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
class GetUser(User):
|
class GetUser(User):
|
||||||
model_config = ConfigDict(extra='forbid', json_encoders={datetime: str})
|
|
||||||
|
|
||||||
cover_url: str
|
cover_url: str
|
||||||
discord: str | None
|
discord: str | None
|
||||||
has_supported: bool
|
has_supported: bool
|
||||||
|
|||||||
Reference in New Issue
Block a user