You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`PageInfoFields`| All paginated queries | hasNextPage, endCursor|
184
184
185
-
ariadne-codegen generates `fragments.py` with Pydantic base classes (`TrackFields`, `ArtistFields`, etc.). Query model classes inherit from these via multiple inheritance, e.g., `GetChartsChartsCountryTracksEdgesNode(TrackFields)`. This means fragment fields are type-safe and IDE-discoverable on all inheriting models.
185
+
**All entity queries use shared fragments.** Every query that returns tracks, albums, artists, or playlists uses the corresponding fragment via `...TrackFields` etc. Some queries (e.g., `get_track.graphql`, `get_album.graphql`) extend the fragment with additional fields like `media`, `lyrics`, `url`, or `tracksCount`.
186
+
187
+
ariadne-codegen generates `fragments.py` with Pydantic base classes (`TrackFields`, `ArtistFields`, etc.). Query model classes inherit from these via multiple inheritance, e.g., `GetChartsChartsCountryTracksEdgesNode(TrackFields)`. This means fragment fields are type-safe and IDE-discoverable on all inheriting models. Consumers can type method parameters as `TrackFields` and accept any query-specific track model.
186
188
187
189
To use a fragment in a new query, reference it with `...TrackFields` in the `.graphql` file.
188
190
@@ -216,6 +218,26 @@ ARL cookie → POST auth.deezer.com/login/arl?jo=p&rto=c&i=c → JWT (6 min TTL)
216
218
- JWT expiration is decoded from the token payload (base64url-encoded second segment)
217
219
- Auto-refresh triggers 30 seconds before expiry
218
220
221
+
### Response Handling
222
+
223
+
The `DeezerBaseClient.get_data()` method handles two important edge cases:
224
+
225
+
1.**Partial errors**: When the GraphQL response contains both `data` and `errors` (e.g., deleted albums in a favorites list), the errors are logged but valid data is returned. Only responses with errors and no data raise `GraphQLClientGraphQLMultiError`.
226
+
227
+
2.**Missing `__typename` injection**: The Deezer API omits `__typename` for single-member union types (e.g., `Contributor` is always `Artist`). Since Pydantic discriminated unions require this field, `_inject_missing_typenames()` recursively patches it into the response before model validation. The mapping is defined in `_TYPENAME_PATCHES`.
228
+
229
+
### Connection Pooling
230
+
231
+
For production use, pass an `httpx.AsyncClient` to avoid creating a new connection for every request:
If no `http_client` is provided, the base client creates (and closes) a throwaway `httpx.AsyncClient` per request. This works but is inefficient for high-volume usage like library syncs.
240
+
219
241
## Key Configuration
220
242
221
243
-**Python**: 3.12+ required (tested on 3.12, 3.13)
0 commit comments