deezer-python-gql 0.18.0__py3-none-any.whl → 0.20.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. deezer_python_gql/base_client.py +15 -0
  2. deezer_python_gql/generated/__init__.py +119 -0
  3. deezer_python_gql/generated/ban_artist_from_recommendation.py +26 -0
  4. deezer_python_gql/generated/ban_track_from_recommendation.py +26 -0
  5. deezer_python_gql/generated/base_client.py +15 -0
  6. deezer_python_gql/generated/client.py +639 -74
  7. deezer_python_gql/generated/enums.py +10 -0
  8. deezer_python_gql/generated/fragments.py +28 -0
  9. deezer_python_gql/generated/get_artist.py +14 -0
  10. deezer_python_gql/generated/get_audiobook.py +1 -0
  11. deezer_python_gql/generated/get_banned_artists.py +51 -0
  12. deezer_python_gql/generated/get_banned_tracks.py +51 -0
  13. deezer_python_gql/generated/get_family.py +34 -0
  14. deezer_python_gql/generated/get_flow_tuner.py +25 -0
  15. deezer_python_gql/generated/get_infinite_track_mix.py +24 -0
  16. deezer_python_gql/generated/get_latest_podcast_episodes.py +27 -0
  17. deezer_python_gql/generated/get_made_for_me.py +1 -0
  18. deezer_python_gql/generated/get_smart_tracklist.py +1 -0
  19. deezer_python_gql/generated/get_track.py +4 -0
  20. deezer_python_gql/generated/get_tracks_by_ids.py +22 -0
  21. deezer_python_gql/generated/set_flow_discovery_tuner.py +20 -0
  22. deezer_python_gql/generated/unban_artist_from_recommendation.py +26 -0
  23. deezer_python_gql/generated/unban_track_from_recommendation.py +26 -0
  24. {deezer_python_gql-0.18.0.dist-info → deezer_python_gql-0.20.0.dist-info}/METADATA +65 -26
  25. {deezer_python_gql-0.18.0.dist-info → deezer_python_gql-0.20.0.dist-info}/RECORD +28 -16
  26. {deezer_python_gql-0.18.0.dist-info → deezer_python_gql-0.20.0.dist-info}/WHEEL +0 -0
  27. {deezer_python_gql-0.18.0.dist-info → deezer_python_gql-0.20.0.dist-info}/licenses/LICENSE +0 -0
  28. {deezer_python_gql-0.18.0.dist-info → deezer_python_gql-0.20.0.dist-info}/top_level.txt +0 -0
@@ -123,6 +123,9 @@ class DeezerBaseClient:
123
123
  :param url: GraphQL endpoint URL (defaults to Pipe API).
124
124
  :param session: Optional pre-configured aiohttp.ClientSession.
125
125
  If provided, the caller is responsible for closing it.
126
+ :param account_id: Optional Deezer Family profile to act as. A profile has no
127
+ ARL of its own; it signs in with the ARL of the Family admin. Only profiles
128
+ that ``get_family()`` marks as ``isLoggableAs`` can be used.
126
129
  """
127
130
 
128
131
  PIPE_URL = "https://pipe.deezer.com/api"
@@ -136,9 +139,11 @@ class DeezerBaseClient:
136
139
  arl: str,
137
140
  url: str = PIPE_URL,
138
141
  session: ClientSession | None = None,
142
+ account_id: str | None = None,
139
143
  ) -> None:
140
144
  self.url = url
141
145
  self._arl = arl
146
+ self._account_id = account_id
142
147
  self._session = session
143
148
  self._owns_session = session is None
144
149
  # An external session may be shared by clients for different Deezer accounts.
@@ -347,12 +352,18 @@ class DeezerBaseClient:
347
352
 
348
353
  logger.debug("JWT expired or missing, refreshing from ARL")
349
354
  params = {"jo": "p", "rto": "c", "i": "c"}
355
+ body = None
356
+ if self._account_id:
357
+ # A Family profile signs in with the admin's ARL and its own id
358
+ params["i"] = "p"
359
+ body = {"arl": self._arl, "account_id": self._account_id}
350
360
 
351
361
  session = self._get_session()
352
362
  async with session.post(
353
363
  self.AUTH_URL,
354
364
  params=params,
355
365
  cookies=self._request_cookies(self.AUTH_URL, include_arl=True),
366
+ json=body,
356
367
  timeout=ClientTimeout(total=10),
357
368
  ) as resp:
358
369
  self._store_cookies(resp)
@@ -383,6 +394,10 @@ class DeezerBaseClient:
383
394
  msg = "Unexpected response from auth.deezer.com (invalid or missing JWT)"
384
395
  raise GraphQLClientAuthError(msg) from exc
385
396
 
397
+ if self._account_id and str(payload.get("userId")) != self._account_id:
398
+ msg = f"auth.deezer.com did not sign in as Family profile {self._account_id}"
399
+ raise GraphQLClientAuthError(msg)
400
+
386
401
  self._jwt = jwt
387
402
  self._jwt_expires_at = expires_at
388
403
  logger.debug("JWT acquired, expires at %s", self._jwt_expires_at)
@@ -34,6 +34,16 @@ from .add_tracks_to_playlist import (
34
34
  AddTracksToPlaylistAddTracksToPlaylistPlaylistAddTracksError,
35
35
  AddTracksToPlaylistAddTracksToPlaylistPlaylistAddTracksOutput,
36
36
  )
37
+ from .ban_artist_from_recommendation import (
38
+ BanArtistFromRecommendation,
39
+ BanArtistFromRecommendationBanArtistFromRecommendation,
40
+ BanArtistFromRecommendationBanArtistFromRecommendationArtist,
41
+ )
42
+ from .ban_track_from_recommendation import (
43
+ BanTrackFromRecommendation,
44
+ BanTrackFromRecommendationBanTrackFromRecommendation,
45
+ BanTrackFromRecommendationBanTrackFromRecommendationTrack,
46
+ )
37
47
  from .base_client import DeezerBaseClient
38
48
  from .base_model import BaseModel, Upload
39
49
  from .bookmark_podcast_episode import (
@@ -51,6 +61,8 @@ from .delete_playlist import DeletePlaylist, DeletePlaylistDeletePlaylist
51
61
  from .enums import (
52
62
  AlbumType,
53
63
  AudiobookContributorRoles,
64
+ DiscoveryTuner,
65
+ DiscoveryTunerInput,
54
66
  MusicTogetherRefreshSuggestedTracklistMoodInput,
55
67
  MusicTogetherSuggestedTracklistMoodInput,
56
68
  PodcastEpisodeOrder,
@@ -63,6 +75,7 @@ from .fragments import (
63
75
  AlbumFieldsContributorsEdges,
64
76
  AlbumFieldsContributorsEdgesNodeArtist,
65
77
  AlbumFieldsCover,
78
+ AlbumFieldsSubtypes,
66
79
  ArtistFields,
67
80
  ArtistFieldsBio,
68
81
  ArtistFieldsPicture,
@@ -73,6 +86,8 @@ from .fragments import (
73
86
  AudiobookFieldsContributorsEdges,
74
87
  AudiobookFieldsContributorsEdgesNodeArtist,
75
88
  AudiobookFieldsCover,
89
+ FamilyProfileFields,
90
+ FamilyProfileFieldsPermissions,
76
91
  LivestreamFields,
77
92
  LivestreamFieldsCover,
78
93
  LivestreamFieldsMedia,
@@ -116,6 +131,8 @@ from .get_artist import (
116
131
  GetArtistArtistAlbumsEdges,
117
132
  GetArtistArtistAlbumsEdgesNode,
118
133
  GetArtistArtistAlbumsPageInfo,
134
+ GetArtistArtistHeroPicture,
135
+ GetArtistArtistSocial,
119
136
  GetArtistArtistTopTracks,
120
137
  GetArtistArtistTopTracksEdges,
121
138
  GetArtistArtistTopTracksEdgesNode,
@@ -151,6 +168,24 @@ from .get_audiobook_chapter import (
151
168
  GetAudiobookChapterAudiobookChapterMediaRightsSub,
152
169
  GetAudiobookChapterAudiobookChapterMediaToken,
153
170
  )
171
+ from .get_banned_artists import (
172
+ GetBannedArtists,
173
+ GetBannedArtistsMe,
174
+ GetBannedArtistsMeBannedFromRecommendation,
175
+ GetBannedArtistsMeBannedFromRecommendationArtists,
176
+ GetBannedArtistsMeBannedFromRecommendationArtistsEdges,
177
+ GetBannedArtistsMeBannedFromRecommendationArtistsEdgesNode,
178
+ GetBannedArtistsMeBannedFromRecommendationArtistsPageInfo,
179
+ )
180
+ from .get_banned_tracks import (
181
+ GetBannedTracks,
182
+ GetBannedTracksMe,
183
+ GetBannedTracksMeBannedFromRecommendation,
184
+ GetBannedTracksMeBannedFromRecommendationTracks,
185
+ GetBannedTracksMeBannedFromRecommendationTracksEdges,
186
+ GetBannedTracksMeBannedFromRecommendationTracksEdgesNode,
187
+ GetBannedTracksMeBannedFromRecommendationTracksPageInfo,
188
+ )
154
189
  from .get_charts import (
155
190
  GetCharts,
156
191
  GetChartsCharts,
@@ -172,6 +207,13 @@ from .get_charts import (
172
207
  GetChartsChartsCountryTracksEdgesNode,
173
208
  GetChartsChartsCountryTracksPageInfo,
174
209
  )
210
+ from .get_family import (
211
+ GetFamily,
212
+ GetFamilyMe,
213
+ GetFamilyMeFamily,
214
+ GetFamilyMeFamilyLinked,
215
+ GetFamilyMeFamilyMain,
216
+ )
175
217
  from .get_favorite_albums import (
176
218
  GetFavoriteAlbums,
177
219
  GetFavoriteAlbumsMe,
@@ -270,6 +312,17 @@ from .get_flow_configs import (
270
312
  GetFlowConfigsMeFlowConfigsMoodsEdgesNodeVisualsHardwareSquareIcon,
271
313
  GetFlowConfigsMeFlowConfigsMoodsPageInfo,
272
314
  )
315
+ from .get_flow_tuner import GetFlowTuner, GetFlowTunerMe, GetFlowTunerMeFlowTuner
316
+ from .get_infinite_track_mix import (
317
+ GetInfiniteTrackMix,
318
+ GetInfiniteTrackMixRawInfiniteTrackMix,
319
+ GetInfiniteTrackMixRawInfiniteTrackMixTracks,
320
+ )
321
+ from .get_latest_podcast_episodes import (
322
+ GetLatestPodcastEpisodes,
323
+ GetLatestPodcastEpisodesMe,
324
+ GetLatestPodcastEpisodesMeRawLatestPodcastEpisodes,
325
+ )
273
326
  from .get_livestream import GetLivestream, GetLivestreamLivestream
274
327
  from .get_made_for_me import (
275
328
  GetMadeForMe,
@@ -472,6 +525,7 @@ from .get_track_mix import (
472
525
  GetTrackMixTrackMixTracks,
473
526
  GetTrackMixTrackMixTracksTrack,
474
527
  )
528
+ from .get_tracks_by_ids import GetTracksByIds, GetTracksByIdsTracksByIds
475
529
  from .get_user_charts import (
476
530
  GetUserCharts,
477
531
  GetUserChartsMe,
@@ -631,6 +685,20 @@ from .search_flows import (
631
685
  SearchFlowsSearchResultsFlowConfigsEdgesNodeVisualsHardwareSquareIcon,
632
686
  SearchFlowsSearchResultsFlowConfigsPageInfo,
633
687
  )
688
+ from .set_flow_discovery_tuner import (
689
+ SetFlowDiscoveryTuner,
690
+ SetFlowDiscoveryTunerSetFlowDiscoveryTuner,
691
+ )
692
+ from .unban_artist_from_recommendation import (
693
+ UnbanArtistFromRecommendation,
694
+ UnbanArtistFromRecommendationUnbanArtistFromRecommendation,
695
+ UnbanArtistFromRecommendationUnbanArtistFromRecommendationArtist,
696
+ )
697
+ from .unban_track_from_recommendation import (
698
+ UnbanTrackFromRecommendation,
699
+ UnbanTrackFromRecommendationUnbanTrackFromRecommendation,
700
+ UnbanTrackFromRecommendationUnbanTrackFromRecommendationTrack,
701
+ )
634
702
  from .unbookmark_podcast_episode import (
635
703
  UnbookmarkPodcastEpisode,
636
704
  UnbookmarkPodcastEpisodeUnbookmarkPodcastEpisode,
@@ -668,6 +736,7 @@ __all__ = [
668
736
  "AlbumFieldsContributorsEdges",
669
737
  "AlbumFieldsContributorsEdgesNodeArtist",
670
738
  "AlbumFieldsCover",
739
+ "AlbumFieldsSubtypes",
671
740
  "AlbumType",
672
741
  "ArtistFields",
673
742
  "ArtistFieldsBio",
@@ -680,6 +749,12 @@ __all__ = [
680
749
  "AudiobookFieldsContributorsEdges",
681
750
  "AudiobookFieldsContributorsEdgesNodeArtist",
682
751
  "AudiobookFieldsCover",
752
+ "BanArtistFromRecommendation",
753
+ "BanArtistFromRecommendationBanArtistFromRecommendation",
754
+ "BanArtistFromRecommendationBanArtistFromRecommendationArtist",
755
+ "BanTrackFromRecommendation",
756
+ "BanTrackFromRecommendationBanTrackFromRecommendation",
757
+ "BanTrackFromRecommendationBanTrackFromRecommendationTrack",
683
758
  "BaseModel",
684
759
  "BookmarkPodcastEpisode",
685
760
  "BookmarkPodcastEpisodeBookmarkPodcastEpisode",
@@ -691,6 +766,10 @@ __all__ = [
691
766
  "DeezerGQLClient",
692
767
  "DeletePlaylist",
693
768
  "DeletePlaylistDeletePlaylist",
769
+ "DiscoveryTuner",
770
+ "DiscoveryTunerInput",
771
+ "FamilyProfileFields",
772
+ "FamilyProfileFieldsPermissions",
694
773
  "GetAlbum",
695
774
  "GetAlbumAlbum",
696
775
  "GetAlbumAlbumFallback",
@@ -706,6 +785,8 @@ __all__ = [
706
785
  "GetArtistArtistAlbumsEdges",
707
786
  "GetArtistArtistAlbumsEdgesNode",
708
787
  "GetArtistArtistAlbumsPageInfo",
788
+ "GetArtistArtistHeroPicture",
789
+ "GetArtistArtistSocial",
709
790
  "GetArtistArtistTopTracks",
710
791
  "GetArtistArtistTopTracksEdges",
711
792
  "GetArtistArtistTopTracksEdgesNode",
@@ -734,6 +815,20 @@ __all__ = [
734
815
  "GetAudiobookChapterAudiobookChapterMediaRightsAds",
735
816
  "GetAudiobookChapterAudiobookChapterMediaRightsSub",
736
817
  "GetAudiobookChapterAudiobookChapterMediaToken",
818
+ "GetBannedArtists",
819
+ "GetBannedArtistsMe",
820
+ "GetBannedArtistsMeBannedFromRecommendation",
821
+ "GetBannedArtistsMeBannedFromRecommendationArtists",
822
+ "GetBannedArtistsMeBannedFromRecommendationArtistsEdges",
823
+ "GetBannedArtistsMeBannedFromRecommendationArtistsEdgesNode",
824
+ "GetBannedArtistsMeBannedFromRecommendationArtistsPageInfo",
825
+ "GetBannedTracks",
826
+ "GetBannedTracksMe",
827
+ "GetBannedTracksMeBannedFromRecommendation",
828
+ "GetBannedTracksMeBannedFromRecommendationTracks",
829
+ "GetBannedTracksMeBannedFromRecommendationTracksEdges",
830
+ "GetBannedTracksMeBannedFromRecommendationTracksEdgesNode",
831
+ "GetBannedTracksMeBannedFromRecommendationTracksPageInfo",
737
832
  "GetCharts",
738
833
  "GetChartsCharts",
739
834
  "GetChartsChartsCountry",
@@ -753,6 +848,11 @@ __all__ = [
753
848
  "GetChartsChartsCountryTracksEdges",
754
849
  "GetChartsChartsCountryTracksEdgesNode",
755
850
  "GetChartsChartsCountryTracksPageInfo",
851
+ "GetFamily",
852
+ "GetFamilyMe",
853
+ "GetFamilyMeFamily",
854
+ "GetFamilyMeFamilyLinked",
855
+ "GetFamilyMeFamilyMain",
756
856
  "GetFavoriteAlbums",
757
857
  "GetFavoriteAlbumsMe",
758
858
  "GetFavoriteAlbumsMeUserFavorites",
@@ -831,6 +931,15 @@ __all__ = [
831
931
  "GetFlowMeFlowCover",
832
932
  "GetFlowMeFlowTracks",
833
933
  "GetFlowMeFlowTracksTrack",
934
+ "GetFlowTuner",
935
+ "GetFlowTunerMe",
936
+ "GetFlowTunerMeFlowTuner",
937
+ "GetInfiniteTrackMix",
938
+ "GetInfiniteTrackMixRawInfiniteTrackMix",
939
+ "GetInfiniteTrackMixRawInfiniteTrackMixTracks",
940
+ "GetLatestPodcastEpisodes",
941
+ "GetLatestPodcastEpisodesMe",
942
+ "GetLatestPodcastEpisodesMeRawLatestPodcastEpisodes",
834
943
  "GetLivestream",
835
944
  "GetLivestreamLivestream",
836
945
  "GetMadeForMe",
@@ -1001,6 +1110,8 @@ __all__ = [
1001
1110
  "GetTrackTrackMediaRightsAds",
1002
1111
  "GetTrackTrackMediaRightsSub",
1003
1112
  "GetTrackTrackMediaToken",
1113
+ "GetTracksByIds",
1114
+ "GetTracksByIdsTracksByIds",
1004
1115
  "GetUserCharts",
1005
1116
  "GetUserChartsMe",
1006
1117
  "GetUserChartsMeCharts",
@@ -1140,6 +1251,8 @@ __all__ = [
1140
1251
  "SearchSearchResultsTracksEdgesNodeMediaRights",
1141
1252
  "SearchSearchResultsTracksEdgesNodeMediaRightsSub",
1142
1253
  "SearchSearchResultsTracksPageInfo",
1254
+ "SetFlowDiscoveryTuner",
1255
+ "SetFlowDiscoveryTunerSetFlowDiscoveryTuner",
1143
1256
  "TrackContributorRoles",
1144
1257
  "TrackFields",
1145
1258
  "TrackFieldsAlbum",
@@ -1151,6 +1264,12 @@ __all__ = [
1151
1264
  "TrackFieldsMedia",
1152
1265
  "TrackFieldsMediaRights",
1153
1266
  "TrackFieldsMediaRightsSub",
1267
+ "UnbanArtistFromRecommendation",
1268
+ "UnbanArtistFromRecommendationUnbanArtistFromRecommendation",
1269
+ "UnbanArtistFromRecommendationUnbanArtistFromRecommendationArtist",
1270
+ "UnbanTrackFromRecommendation",
1271
+ "UnbanTrackFromRecommendationUnbanTrackFromRecommendation",
1272
+ "UnbanTrackFromRecommendationUnbanTrackFromRecommendationTrack",
1154
1273
  "UnbookmarkPodcastEpisode",
1155
1274
  "UnbookmarkPodcastEpisodeUnbookmarkPodcastEpisode",
1156
1275
  "UnbookmarkPodcastEpisodeUnbookmarkPodcastEpisodeEpisode",
@@ -0,0 +1,26 @@
1
+ # Generated by ariadne-codegen
2
+ # Source: queries
3
+
4
+ from pydantic import Field
5
+
6
+ from .base_model import BaseModel
7
+
8
+
9
+ class BanArtistFromRecommendation(BaseModel):
10
+ ban_artist_from_recommendation: "BanArtistFromRecommendationBanArtistFromRecommendation" = Field(
11
+ alias="banArtistFromRecommendation"
12
+ )
13
+
14
+
15
+ class BanArtistFromRecommendationBanArtistFromRecommendation(BaseModel):
16
+ status: bool
17
+ artist: "BanArtistFromRecommendationBanArtistFromRecommendationArtist"
18
+
19
+
20
+ class BanArtistFromRecommendationBanArtistFromRecommendationArtist(BaseModel):
21
+ id: str
22
+ name: str
23
+
24
+
25
+ BanArtistFromRecommendation.model_rebuild()
26
+ BanArtistFromRecommendationBanArtistFromRecommendation.model_rebuild()
@@ -0,0 +1,26 @@
1
+ # Generated by ariadne-codegen
2
+ # Source: queries
3
+
4
+ from pydantic import Field
5
+
6
+ from .base_model import BaseModel
7
+
8
+
9
+ class BanTrackFromRecommendation(BaseModel):
10
+ ban_track_from_recommendation: "BanTrackFromRecommendationBanTrackFromRecommendation" = Field(
11
+ alias="banTrackFromRecommendation"
12
+ )
13
+
14
+
15
+ class BanTrackFromRecommendationBanTrackFromRecommendation(BaseModel):
16
+ status: bool
17
+ track: "BanTrackFromRecommendationBanTrackFromRecommendationTrack"
18
+
19
+
20
+ class BanTrackFromRecommendationBanTrackFromRecommendationTrack(BaseModel):
21
+ id: str
22
+ title: str
23
+
24
+
25
+ BanTrackFromRecommendation.model_rebuild()
26
+ BanTrackFromRecommendationBanTrackFromRecommendation.model_rebuild()
@@ -125,6 +125,9 @@ class DeezerBaseClient:
125
125
  :param url: GraphQL endpoint URL (defaults to Pipe API).
126
126
  :param session: Optional pre-configured aiohttp.ClientSession.
127
127
  If provided, the caller is responsible for closing it.
128
+ :param account_id: Optional Deezer Family profile to act as. A profile has no
129
+ ARL of its own; it signs in with the ARL of the Family admin. Only profiles
130
+ that ``get_family()`` marks as ``isLoggableAs`` can be used.
128
131
  """
129
132
 
130
133
  PIPE_URL = "https://pipe.deezer.com/api"
@@ -138,9 +141,11 @@ class DeezerBaseClient:
138
141
  arl: str,
139
142
  url: str = PIPE_URL,
140
143
  session: ClientSession | None = None,
144
+ account_id: str | None = None,
141
145
  ) -> None:
142
146
  self.url = url
143
147
  self._arl = arl
148
+ self._account_id = account_id
144
149
  self._session = session
145
150
  self._owns_session = session is None
146
151
  # An external session may be shared by clients for different Deezer accounts.
@@ -349,12 +354,18 @@ class DeezerBaseClient:
349
354
 
350
355
  logger.debug("JWT expired or missing, refreshing from ARL")
351
356
  params = {"jo": "p", "rto": "c", "i": "c"}
357
+ body = None
358
+ if self._account_id:
359
+ # A Family profile signs in with the admin's ARL and its own id
360
+ params["i"] = "p"
361
+ body = {"arl": self._arl, "account_id": self._account_id}
352
362
 
353
363
  session = self._get_session()
354
364
  async with session.post(
355
365
  self.AUTH_URL,
356
366
  params=params,
357
367
  cookies=self._request_cookies(self.AUTH_URL, include_arl=True),
368
+ json=body,
358
369
  timeout=ClientTimeout(total=10),
359
370
  ) as resp:
360
371
  self._store_cookies(resp)
@@ -385,6 +396,10 @@ class DeezerBaseClient:
385
396
  msg = "Unexpected response from auth.deezer.com (invalid or missing JWT)"
386
397
  raise GraphQLClientAuthError(msg) from exc
387
398
 
399
+ if self._account_id and str(payload.get("userId")) != self._account_id:
400
+ msg = f"auth.deezer.com did not sign in as Family profile {self._account_id}"
401
+ raise GraphQLClientAuthError(msg)
402
+
388
403
  self._jwt = jwt
389
404
  self._jwt_expires_at = expires_at
390
405
  logger.debug("JWT acquired, expires at %s", self._jwt_expires_at)