Enums¶
All enums are str-based: members compare equal to and serialize exactly like their raw
API strings, so plain strings keep working everywhere.
from deezify import SearchOrder, Permission, RecommendationKind
SearchOrder.RANKING == "RANKING" # True
str(SearchOrder.TRACK_ASC) # "TRACK_ASC"
client.search.tracks("eminem", order=SearchOrder.RANKING, limit=5)
client.search.tracks("eminem", order="RANKING", limit=5) # identical
client.user.recommendations("me", RecommendationKind.TRACKS)
authorization_url(APP_ID, REDIRECT, perms=[Permission.EMAIL])
| Enum | Values |
|---|---|
SearchOrder |
RANKING TRACK_ASC TRACK_DESC ARTIST_ASC ARTIST_DESC ALBUM_ASC ALBUM_DESC RATING_ASC RATING_DESC DURATION_ASC DURATION_DESC |
SearchField |
artist album track label dur_min dur_max bpm_min bpm_max |
Permission |
basic_access email offline_access manage_library manage_community delete_library listening_history |
RecommendationKind |
albums artists playlists tracks radios releases |
UserChartKind |
albums playlists tracks |
OEmbedFormat |
json xml (only json is decoded) |
EntityType |
track album artist playlist user podcast episode radio genre editorial options chart |
Gender / RecordType / ExplicitContentLevel |
typing helpers for user/album fields |
deezify.enums
¶
Central enums for the Deezer SDK.
All enums are str-based (class X(str, Enum)), so every member
compares equal to — and serializes exactly like — its raw API string::
SearchOrder.RANKING == "RANKING" # True
f"{SearchOrder.TRACK_ASC}" # "TRACK_ASC" (str Enum)
json.dumps({"order": SearchOrder.RANKING}) # '{"order": "RANKING"}'
This means enums are purely additive convenience: anywhere the SDK accepts
a str you may pass either the plain string or the enum member.
Validation helpers accept both and always send the plain string value.
SearchOrder
¶
Bases: _StrEnum
Sort orders accepted by GET /search* (order=...).
Source code in deezify/enums.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
SearchField
¶
Bases: _StrEnum
Field names for advanced search (q=field:value).
Source code in deezify/enums.py
62 63 64 65 66 67 68 69 70 71 72 | |
Permission
¶
Bases: _StrEnum
OAuth permission scopes (perms=...).
Source code in deezify/enums.py
75 76 77 78 79 80 81 82 83 84 | |
RecommendationKind
¶
Bases: _StrEnum
Recommendation feeds (GET /user/{id}/recommendations/{kind}).
Source code in deezify/enums.py
87 88 89 90 91 92 93 94 95 | |
UserChartKind
¶
Bases: _StrEnum
User chart feeds (GET /user/{id}/charts/{kind}).
Source code in deezify/enums.py
98 99 100 101 102 103 | |
ExplicitContentLevel
¶
Bases: _StrEnum
Values of user.explicit_content_levels_available[].
Source code in deezify/enums.py
106 107 108 109 110 111 | |
Gender
¶
Bases: _StrEnum
Values of user.gender.
Source code in deezify/enums.py
114 115 116 117 118 | |
RecordType
¶
Bases: _StrEnum
Common values of album.record_type (open-ended at the API).
Source code in deezify/enums.py
121 122 123 124 125 126 | |
OEmbedFormat
¶
Bases: _StrEnum
Response formats for GET /oembed.
Source code in deezify/enums.py
129 130 131 132 133 | |
EntityType
¶
Bases: _StrEnum
The type discriminator on API objects and oEmbed entity.
Source code in deezify/enums.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | |
coerce_optional_enum(enum_cls, value, *, label)
¶
Coerce an optional enum/str parameter to its wire string.
Source code in deezify/enums.py
153 154 155 156 157 158 159 | |