checkleaked-spotify-api 1.0.0__tar.gz
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.
- checkleaked_spotify_api-1.0.0/.gitignore +9 -0
- checkleaked_spotify_api-1.0.0/API_REFERENCE.md +190 -0
- checkleaked_spotify_api-1.0.0/CHANGELOG.md +11 -0
- checkleaked_spotify_api-1.0.0/LICENSE +22 -0
- checkleaked_spotify_api-1.0.0/PKG-INFO +201 -0
- checkleaked_spotify_api-1.0.0/README.md +167 -0
- checkleaked_spotify_api-1.0.0/pyproject.toml +82 -0
- checkleaked_spotify_api-1.0.0/scripts/generate_resources.mjs +462 -0
- checkleaked_spotify_api-1.0.0/src/spotify_api_sdk/__init__.py +53 -0
- checkleaked_spotify_api-1.0.0/src/spotify_api_sdk/_resource.py +81 -0
- checkleaked_spotify_api-1.0.0/src/spotify_api_sdk/client.py +71 -0
- checkleaked_spotify_api-1.0.0/src/spotify_api_sdk/config.py +134 -0
- checkleaked_spotify_api-1.0.0/src/spotify_api_sdk/errors.py +68 -0
- checkleaked_spotify_api-1.0.0/src/spotify_api_sdk/http.py +447 -0
- checkleaked_spotify_api-1.0.0/src/spotify_api_sdk/ids.py +42 -0
- checkleaked_spotify_api-1.0.0/src/spotify_api_sdk/pagination.py +70 -0
- checkleaked_spotify_api-1.0.0/src/spotify_api_sdk/py.typed +1 -0
- checkleaked_spotify_api-1.0.0/src/spotify_api_sdk/resources.py +2666 -0
- checkleaked_spotify_api-1.0.0/src/spotify_api_sdk/types.py +31 -0
- checkleaked_spotify_api-1.0.0/tests/__init__.py +1 -0
- checkleaked_spotify_api-1.0.0/tests/helpers.py +43 -0
- checkleaked_spotify_api-1.0.0/tests/test_config.py +53 -0
- checkleaked_spotify_api-1.0.0/tests/test_ids_pagination.py +39 -0
- checkleaked_spotify_api-1.0.0/tests/test_live.py +42 -0
- checkleaked_spotify_api-1.0.0/tests/test_resources.py +85 -0
- checkleaked_spotify_api-1.0.0/tests/test_transport.py +154 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# API reference
|
|
2
|
+
|
|
3
|
+
Generated from the canonical TypeScript SDK and OpenAPI contract.
|
|
4
|
+
Pythonic `snake_case` methods also expose their npm-compatible `camelCase` aliases.
|
|
5
|
+
|
|
6
|
+
## `ai`
|
|
7
|
+
|
|
8
|
+
- `health(query=None)` — GET `/ai/health`
|
|
9
|
+
- `types(query=None)` — GET `/ai/types`
|
|
10
|
+
- `analyze(query=None, body=None)` — POST `/ai/analyze`
|
|
11
|
+
- `chart_trends(query=None, body=None)` (alias: `chartTrends`) — POST `/ai/chart-trends`
|
|
12
|
+
- `artist_summary(query=None, body=None)` (alias: `artistSummary`) — POST `/ai/artist-summary`
|
|
13
|
+
- `album_review(query=None, body=None)` (alias: `albumReview`) — POST `/ai/album-review`
|
|
14
|
+
- `track_deep_dive(query=None, body=None)` (alias: `trackDeepDive`) — POST `/ai/track-deep-dive`
|
|
15
|
+
- `playlist_curator(query=None, body=None)` (alias: `playlistCurator`) — POST `/ai/playlist-curator`
|
|
16
|
+
- `market_comparison(query=None, body=None)` (alias: `marketComparison`) — POST `/ai/market-comparison`
|
|
17
|
+
- `genre_landscape(query=None, body=None)` (alias: `genreLandscape`) — POST `/ai/genre-landscape`
|
|
18
|
+
- `mood_profile(query=None, body=None)` (alias: `moodProfile`) — POST `/ai/mood-profile`
|
|
19
|
+
- `viral_potential(query=None, body=None)` (alias: `viralPotential`) — POST `/ai/viral-potential`
|
|
20
|
+
- `custom(query=None, body=None)` — POST `/ai/custom`
|
|
21
|
+
|
|
22
|
+
## `albums`
|
|
23
|
+
|
|
24
|
+
- `get(ids, contrast=None)` — GET `/albums`
|
|
25
|
+
- `tracks(id, offset=None, limit=None)` — GET `/album_tracks`
|
|
26
|
+
- `metadata(id, contrast=None)` — GET `/album_metadata`
|
|
27
|
+
|
|
28
|
+
## `analysis`
|
|
29
|
+
|
|
30
|
+
- `artist_compare(ids)` (alias: `artistCompare`) — GET `/artist_compare`
|
|
31
|
+
- `audio_features(id)` (alias: `audioFeatures`) — GET `/audio_features`
|
|
32
|
+
- `playlist_analysis(id)` (alias: `playlistAnalysis`) — GET `/playlist_analysis`
|
|
33
|
+
|
|
34
|
+
## `artists`
|
|
35
|
+
|
|
36
|
+
- `get(ids, contrast=None)` — GET `/artists`
|
|
37
|
+
- `overview(id, contrast=None)` — GET `/artist_overview`
|
|
38
|
+
- `discography_overview(id)` (alias: `discographyOverview`) — GET `/artist_discography_overview`
|
|
39
|
+
- `albums(id, offset=None, limit=None)` — GET `/artist_albums`
|
|
40
|
+
- `singles(id, offset=None, limit=None)` — GET `/artist_singles`
|
|
41
|
+
- `appears_on(id)` (alias: `appearsOn`) — GET `/artist_appears_on`
|
|
42
|
+
- `discovered_on(id)` (alias: `discoveredOn`) — GET `/artist_discovered_on`
|
|
43
|
+
- `featuring(id)` — GET `/artist_featuring`
|
|
44
|
+
- `related(id)` — GET `/artist_related`
|
|
45
|
+
- `top_tracks(id, market=None)` (alias: `topTracks`) — GET `/artist_top_tracks`
|
|
46
|
+
|
|
47
|
+
## `audiobooks`
|
|
48
|
+
|
|
49
|
+
- `get(ids, market=None)` — GET `/audiobooks`
|
|
50
|
+
- `get_by_id(id, market=None)` (alias: `getById`) — GET `/audiobooks/{id}`
|
|
51
|
+
- `chapters(id, offset=None, limit=None)` — GET `/audiobooks/{id}/chapters`
|
|
52
|
+
|
|
53
|
+
## `batch`
|
|
54
|
+
|
|
55
|
+
- `album_metadata(ids)` (alias: `albumMetadata`) — GET `/album_metadata_batch`
|
|
56
|
+
- `artist_overview(ids)` (alias: `artistOverview`) — GET `/artist_overview_batch`
|
|
57
|
+
- `track_credits(ids)` (alias: `trackCredits`) — GET `/track_credits_batch`
|
|
58
|
+
- `track_lyrics(ids, format=None)` (alias: `trackLyrics`) — GET `/track_lyrics_batch`
|
|
59
|
+
- `track_popularity(ids)` (alias: `trackPopularity`) — GET `/track_popularity_batch`
|
|
60
|
+
|
|
61
|
+
## `browse`
|
|
62
|
+
|
|
63
|
+
- `categories(country=None, locale=None, limit=None, offset=None)` — GET `/browse/categories`
|
|
64
|
+
- `category(id, country=None, locale=None)` — GET `/browse/categories/{id}`
|
|
65
|
+
- `featured_playlists(country=None, locale=None, limit=None, offset=None)` (alias: `featuredPlaylists`) — GET `/browse/featured-playlists`
|
|
66
|
+
- `new_releases(country=None, limit=None, offset=None)` (alias: `newReleases`) — GET `/browse/new-releases`
|
|
67
|
+
- `recommendations(seed_tracks=None, seed_artists=None, seed_genres=None, limit=None)` — GET `/browse/recommendations`
|
|
68
|
+
|
|
69
|
+
## `cache`
|
|
70
|
+
|
|
71
|
+
- `stats(query=None)` — GET `/cache/stats`
|
|
72
|
+
- `invalidate(key=None, pattern=None)` — POST `/cache/invalidate`
|
|
73
|
+
|
|
74
|
+
## `charts`
|
|
75
|
+
|
|
76
|
+
- `top_by_monthly_listeners(query=None)` (alias: `topByMonthlyListeners`) — GET `/top_20_by_monthly_listeners`
|
|
77
|
+
- `top200_tracks(period=None, country=None, date=None)` (alias: `top200Tracks`) — GET `/top_200_tracks`
|
|
78
|
+
- `top_artists(period=None, country=None)` (alias: `topArtists`) — GET `/top_artists`
|
|
79
|
+
- `top_albums(period=None, country=None)` (alias: `topAlbums`) — GET `/top_albums`
|
|
80
|
+
- `viral_tracks(country=None)` (alias: `viralTracks`) — GET `/viral_tracks`
|
|
81
|
+
- `top_by_followers(query=None)` (alias: `topByFollowers`) — GET `/top_20_by_followers`
|
|
82
|
+
|
|
83
|
+
## `concerts`
|
|
84
|
+
|
|
85
|
+
- `locations(query)` — GET `/partner/concert-locations`
|
|
86
|
+
- `feed(geo_hash, geoname_id, from_=None, to=None, radius_in_km=None, concept_uris=None, pagination_key=None, details=None, details_limit=None, parsed=None)` — GET `/partner/concert-feed`
|
|
87
|
+
- `get(id, parsed=None, authenticated=None)` — GET `/partner/concert`
|
|
88
|
+
- `by_artist(id, geo_hash=None, include_nearby=None, details=None, details_limit=None, parsed=None)` (alias: `byArtist`) — GET `/partner/artist-concerts`
|
|
89
|
+
- `search_artists(query, geo_hash=None, include_nearby=None, limit=None, details=None, details_limit=None, parsed=None)` (alias: `searchArtists`) — GET `/partner/search-concert-artists`
|
|
90
|
+
|
|
91
|
+
## `credentials`
|
|
92
|
+
|
|
93
|
+
- `status(query=None)` — GET `/credentials/status`
|
|
94
|
+
- `redis_cookies(query=None)` (alias: `redisCookies`) — GET `/cookies/redis`
|
|
95
|
+
|
|
96
|
+
## `downloads`
|
|
97
|
+
|
|
98
|
+
- `track(q)` — GET `/download_track`
|
|
99
|
+
- `soundcloud(q)` — GET `/download_track_sc`
|
|
100
|
+
|
|
101
|
+
## `episodes`
|
|
102
|
+
|
|
103
|
+
- `get(ids, market=None)` — GET `/episodes`
|
|
104
|
+
- `by_id(id, market=None)` (alias: `byId`) — GET `/episodes/{id}`
|
|
105
|
+
|
|
106
|
+
## `health`
|
|
107
|
+
|
|
108
|
+
- `ping(query=None)` — GET `/ping`
|
|
109
|
+
- `get(query=None)` — GET `/health`
|
|
110
|
+
- `instance(query=None)` — GET `/health/instance`
|
|
111
|
+
- `cluster(query=None)` — GET `/health/cluster`
|
|
112
|
+
- `cluster_strict(query=None)` (alias: `clusterStrict`) — GET `/health/cluster/strict`
|
|
113
|
+
- `proxies(query=None)` — GET `/health/proxies`
|
|
114
|
+
- `clear_proxies(query=None, body=None)` (alias: `clearProxies`) — POST `/health/proxies/clear`
|
|
115
|
+
- `clear_errors(query=None, body=None)` (alias: `clearErrors`) — POST `/health/clear-errors`
|
|
116
|
+
|
|
117
|
+
## `lookups`
|
|
118
|
+
|
|
119
|
+
- `isrc(isrc)` — GET `/isrc_lookup`
|
|
120
|
+
- `upc(upc)` — GET `/upc_lookup`
|
|
121
|
+
|
|
122
|
+
## `markets`
|
|
123
|
+
|
|
124
|
+
- `get(query=None)` — GET `/markets`
|
|
125
|
+
|
|
126
|
+
## `partner`
|
|
127
|
+
|
|
128
|
+
- `playlist(id, offset=None, limit=None)` — GET `/partner/playlist`
|
|
129
|
+
- `track(id)` — GET `/partner/track`
|
|
130
|
+
- `track_count(spotify_track_id=None, isrc=None)` (alias: `trackCount`) — GET `/partner/track/count`
|
|
131
|
+
- `album(id, locale=None, offset=None, limit=None)` — GET `/partner/album`
|
|
132
|
+
- `artist_overview(id, locale=None, include_prerelease=None)` (alias: `artistOverview`) — GET `/partner/artist-overview`
|
|
133
|
+
- `artist_discography(id, offset=None, limit=None)` (alias: `artistDiscography`) — GET `/partner/artist-discography`
|
|
134
|
+
|
|
135
|
+
## `playlists`
|
|
136
|
+
|
|
137
|
+
- `get(id)` — GET `/playlist`
|
|
138
|
+
- `tracks(id, offset=None, limit=None)` — GET `/playlist_tracks`
|
|
139
|
+
- `from_seed(uri)` (alias: `fromSeed`) — GET `/seed_to_playlist`
|
|
140
|
+
|
|
141
|
+
## `search`
|
|
142
|
+
|
|
143
|
+
- `search(q, type=None, offset=None, limit=None, number_of_top_results=None, contrast=None)` — GET `/search`
|
|
144
|
+
- `top_results(q, number_of_top_results=None, contrast=None)` (alias: `topResults`) — GET `/search_top_results`
|
|
145
|
+
- `lyrics(q, format=None)` — GET `/search_lyrics`
|
|
146
|
+
- `suggestions(q, offset=None, limit=None, number_of_top_results=None, include_authors=None, debug=None, timeout=None, contrast=None)` — GET `/search_suggestions`
|
|
147
|
+
- `multi_market(q, type=None, markets=None, limit=None)` (alias: `multiMarket`) — GET `/search_multi_market`
|
|
148
|
+
|
|
149
|
+
## `shows`
|
|
150
|
+
|
|
151
|
+
- `get(ids, market=None)` — GET `/shows`
|
|
152
|
+
- `get_by_id(id, market=None)` (alias: `getById`) — GET `/shows/{id}`
|
|
153
|
+
- `episodes(id, offset=None, limit=None)` — GET `/shows/{id}/episodes`
|
|
154
|
+
|
|
155
|
+
## `snapshots`
|
|
156
|
+
|
|
157
|
+
- `list(id)` — GET `/playlist_snapshot`
|
|
158
|
+
- `create(id=None, webhook=None)` — POST `/playlist_snapshot`
|
|
159
|
+
|
|
160
|
+
## `tracking`
|
|
161
|
+
|
|
162
|
+
- `track(type, id)` — POST `/tracking/track`
|
|
163
|
+
- `untrack(type, id)` — DELETE `/tracking/untrack`
|
|
164
|
+
- `items(offset=None, limit=None)` — GET `/tracking/items`
|
|
165
|
+
- `item(spotify_type, spotify_id)` — GET `/tracking/items/{spotifyType}/{spotifyId}`
|
|
166
|
+
- `logs(offset=None, limit=None)` — GET `/tracking/logs`
|
|
167
|
+
- `stats(query=None)` — GET `/tracking/stats`
|
|
168
|
+
- `health(query=None)` — GET `/tracking/health`
|
|
169
|
+
|
|
170
|
+
## `tracks`
|
|
171
|
+
|
|
172
|
+
- `get(ids, contrast=None)` — GET `/tracks`
|
|
173
|
+
- `credits(id)` — GET `/track_credits`
|
|
174
|
+
- `lyrics(id, format=None, vocal_removal=None)` — GET `/track_lyrics`
|
|
175
|
+
- `recommendations(limit=None, seed_tracks=None, seed_artists=None, seed_genres=None)` — GET `/recommendations`
|
|
176
|
+
|
|
177
|
+
## `users`
|
|
178
|
+
|
|
179
|
+
- `profile(id, playlist_limit=None, artist_limit=None, episode_limit=None)` — GET `/user_profile`
|
|
180
|
+
- `followers(id)` — GET `/user_followers`
|
|
181
|
+
|
|
182
|
+
## `webhooks`
|
|
183
|
+
|
|
184
|
+
- `get(query=None)` — GET `/webhooks`
|
|
185
|
+
- `register(url=None, events=None)` — POST `/webhooks/register`
|
|
186
|
+
- `stats(query=None)` — GET `/webhooks/stats`
|
|
187
|
+
- `delete(id)` — DELETE `/webhooks/{id}`
|
|
188
|
+
- `test(id)` — POST `/webhooks/{id}/test`
|
|
189
|
+
- `deliveries(id)` — GET `/webhooks/{id}/deliveries`
|
|
190
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0.0 - 2026-07-26
|
|
4
|
+
|
|
5
|
+
- Initial Python release matching `@checkleaked/spotify-api`.
|
|
6
|
+
- 110 methods across all 25 Spotify Data API namespaces.
|
|
7
|
+
- RapidAPI `spotify81` and direct CheckLeaked proxy provider presets.
|
|
8
|
+
- Typed parameters, Spotify ID/URI/URL normalization, pagination helpers,
|
|
9
|
+
retries, timeouts, lifecycle hooks, structured errors, and sync context
|
|
10
|
+
manager support.
|
|
11
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Eduardo Airaudo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: checkleaked-spotify-api
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Typed Python SDK for the CheckLeaked Spotify Data API and RapidAPI spotify81.
|
|
5
|
+
Project-URL: Homepage, https://spotify-proxy.checkleaked.cc
|
|
6
|
+
Project-URL: Documentation, https://spotify-proxy.checkleaked.cc/docs
|
|
7
|
+
Project-URL: Repository, https://github.com/eduair94/checkleaked-spotify-api-python
|
|
8
|
+
Project-URL: Issues, https://github.com/eduair94/checkleaked-spotify-api-python/issues
|
|
9
|
+
Project-URL: OpenAPI, https://spotify-proxy.checkleaked.cc/openapi.json
|
|
10
|
+
Author-email: Eduardo Airaudo <airaudoeduardo@gmail.com>
|
|
11
|
+
License: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: charts,checkleaked,concerts,lyrics,music,rapidapi,sdk,spotify,spotify-api,spotify-data,spotify81
|
|
14
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Typing :: Typed
|
|
25
|
+
Requires-Python: >=3.8
|
|
26
|
+
Requires-Dist: requests>=2.25
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: build; extra == 'dev'
|
|
29
|
+
Requires-Dist: mypy>=1.8; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest>=7; extra == 'dev'
|
|
31
|
+
Requires-Dist: twine; extra == 'dev'
|
|
32
|
+
Requires-Dist: types-requests; extra == 'dev'
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
# checkleaked-spotify-api
|
|
36
|
+
|
|
37
|
+
[](https://pypi.org/project/checkleaked-spotify-api/)
|
|
38
|
+
[](https://pypi.org/project/checkleaked-spotify-api/)
|
|
39
|
+
[](https://github.com/eduair94/checkleaked-spotify-api-python/actions/workflows/ci.yml)
|
|
40
|
+
[](./LICENSE)
|
|
41
|
+
|
|
42
|
+
Typed Python SDK for the **Spotify Data API**, covering the same 110 methods
|
|
43
|
+
and 25 namespaces as
|
|
44
|
+
[`@checkleaked/spotify-api`](https://www.npmjs.com/package/@checkleaked/spotify-api).
|
|
45
|
+
It works with both the
|
|
46
|
+
[RapidAPI spotify81 API](https://rapidapi.com/airaudoeduardo/api/spotify81)
|
|
47
|
+
and the direct
|
|
48
|
+
[CheckLeaked proxy](https://spotify-proxy.checkleaked.cc/docs).
|
|
49
|
+
|
|
50
|
+
This is a data API client. It does not require Spotify OAuth credentials.
|
|
51
|
+
|
|
52
|
+
## Install
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pip install checkleaked-spotify-api
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Quick start
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from spotify_api_sdk import SpotifyApiClient
|
|
62
|
+
|
|
63
|
+
spotify = SpotifyApiClient(api_key="your-rapidapi-key")
|
|
64
|
+
|
|
65
|
+
results = spotify.search.search(
|
|
66
|
+
"daft punk",
|
|
67
|
+
type="artists",
|
|
68
|
+
limit=5,
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
artist = spotify.artists.overview(
|
|
72
|
+
"spotify:artist:4tZwfgrHOc3mvqYlEYSvVi"
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
lyrics = spotify.tracks.lyrics(
|
|
76
|
+
"https://open.spotify.com/track/0DiWol3AO6WpXZgp0goxAV",
|
|
77
|
+
format="lrc",
|
|
78
|
+
)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Methods return the API's unwrapped `data` payload. Use
|
|
82
|
+
`client.request_raw(...)` when you need the complete success envelope.
|
|
83
|
+
|
|
84
|
+
## Providers
|
|
85
|
+
|
|
86
|
+
RapidAPI is the default and automatically adds
|
|
87
|
+
`x-rapidapi-host: spotify81.p.rapidapi.com`:
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
spotify = SpotifyApiClient(
|
|
91
|
+
api_key="your-rapidapi-key",
|
|
92
|
+
provider="rapidapi",
|
|
93
|
+
)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
The direct proxy exposes the same methods and paths. Use a key issued by the
|
|
97
|
+
direct portal:
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
spotify = SpotifyApiClient(
|
|
101
|
+
api_key="your-direct-proxy-key",
|
|
102
|
+
provider="proxy",
|
|
103
|
+
)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
The API key may be omitted when `SPOTIFY_API_KEY` or `RAPIDAPI_KEY` is set.
|
|
107
|
+
|
|
108
|
+
## Pythonic and npm-compatible names
|
|
109
|
+
|
|
110
|
+
Python methods use `snake_case`, while npm-style `camelCase` aliases are also
|
|
111
|
+
available:
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
spotify.artists.top_tracks(id, market="US")
|
|
115
|
+
spotify.artists.topTracks(id, market="US") # exact npm-style alias
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Every method supports per-call `request_timeout`, `request_retries`,
|
|
119
|
+
`request_headers`, and an additional `extra_query` mapping. POST methods also
|
|
120
|
+
accept a free-form `body` mapping.
|
|
121
|
+
|
|
122
|
+
## IDs, URIs, and URLs
|
|
123
|
+
|
|
124
|
+
Spotify IDs may be supplied as bare IDs, Spotify URIs, or open.spotify.com
|
|
125
|
+
URLs. Multi-ID methods accept comma-separated strings or Python sequences.
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
from spotify_api_sdk import normalize_id, normalize_ids
|
|
129
|
+
|
|
130
|
+
normalize_id("spotify:track:0DiWol3AO6WpXZgp0goxAV")
|
|
131
|
+
normalize_ids([
|
|
132
|
+
"spotify:artist:4tZwfgrHOc3mvqYlEYSvVi",
|
|
133
|
+
"https://open.spotify.com/artist/06HL4z0CvFAxyc27GXpf02",
|
|
134
|
+
])
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Pagination
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
from spotify_api_sdk import collect
|
|
141
|
+
|
|
142
|
+
items = collect(
|
|
143
|
+
lambda **page: spotify.artists.albums(id=artist_id, **page),
|
|
144
|
+
get_items=lambda response: (
|
|
145
|
+
response.get("data", {})
|
|
146
|
+
.get("artist", {})
|
|
147
|
+
.get("discography", {})
|
|
148
|
+
.get("albums", {})
|
|
149
|
+
.get("items", [])
|
|
150
|
+
),
|
|
151
|
+
limit=50,
|
|
152
|
+
max_items=500,
|
|
153
|
+
)
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Errors
|
|
157
|
+
|
|
158
|
+
```python
|
|
159
|
+
from spotify_api_sdk import (
|
|
160
|
+
AuthError,
|
|
161
|
+
HttpError,
|
|
162
|
+
RateLimitError,
|
|
163
|
+
SpotifyApiError,
|
|
164
|
+
TimeoutError,
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
try:
|
|
168
|
+
spotify.search.search("daft punk")
|
|
169
|
+
except RateLimitError as error:
|
|
170
|
+
print(error.retry_after_ms)
|
|
171
|
+
except AuthError:
|
|
172
|
+
print("Invalid or unsubscribed API key")
|
|
173
|
+
except SpotifyApiError as error:
|
|
174
|
+
print(error.status, error.code, error.url)
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Configuration
|
|
178
|
+
|
|
179
|
+
```python
|
|
180
|
+
spotify = SpotifyApiClient(
|
|
181
|
+
api_key="...",
|
|
182
|
+
provider="rapidapi", # rapidapi (default) | proxy
|
|
183
|
+
timeout=30,
|
|
184
|
+
retries=2,
|
|
185
|
+
retry_delay=0.5,
|
|
186
|
+
headers={"x-my-header": "value"},
|
|
187
|
+
debug=True,
|
|
188
|
+
on_request=lambda info: print("request", info["url"]),
|
|
189
|
+
on_response=lambda info: print("response", info["status"]),
|
|
190
|
+
on_retry=lambda info: print("retry", info["attempt"]),
|
|
191
|
+
)
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
The client is also a context manager:
|
|
195
|
+
|
|
196
|
+
```python
|
|
197
|
+
with SpotifyApiClient(api_key="...") as spotify:
|
|
198
|
+
markets = spotify.markets.get()
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
See [API_REFERENCE.md](./API_REFERENCE.md) for every namespace and method.
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# checkleaked-spotify-api
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/checkleaked-spotify-api/)
|
|
4
|
+
[](https://pypi.org/project/checkleaked-spotify-api/)
|
|
5
|
+
[](https://github.com/eduair94/checkleaked-spotify-api-python/actions/workflows/ci.yml)
|
|
6
|
+
[](./LICENSE)
|
|
7
|
+
|
|
8
|
+
Typed Python SDK for the **Spotify Data API**, covering the same 110 methods
|
|
9
|
+
and 25 namespaces as
|
|
10
|
+
[`@checkleaked/spotify-api`](https://www.npmjs.com/package/@checkleaked/spotify-api).
|
|
11
|
+
It works with both the
|
|
12
|
+
[RapidAPI spotify81 API](https://rapidapi.com/airaudoeduardo/api/spotify81)
|
|
13
|
+
and the direct
|
|
14
|
+
[CheckLeaked proxy](https://spotify-proxy.checkleaked.cc/docs).
|
|
15
|
+
|
|
16
|
+
This is a data API client. It does not require Spotify OAuth credentials.
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install checkleaked-spotify-api
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Quick start
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
from spotify_api_sdk import SpotifyApiClient
|
|
28
|
+
|
|
29
|
+
spotify = SpotifyApiClient(api_key="your-rapidapi-key")
|
|
30
|
+
|
|
31
|
+
results = spotify.search.search(
|
|
32
|
+
"daft punk",
|
|
33
|
+
type="artists",
|
|
34
|
+
limit=5,
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
artist = spotify.artists.overview(
|
|
38
|
+
"spotify:artist:4tZwfgrHOc3mvqYlEYSvVi"
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
lyrics = spotify.tracks.lyrics(
|
|
42
|
+
"https://open.spotify.com/track/0DiWol3AO6WpXZgp0goxAV",
|
|
43
|
+
format="lrc",
|
|
44
|
+
)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Methods return the API's unwrapped `data` payload. Use
|
|
48
|
+
`client.request_raw(...)` when you need the complete success envelope.
|
|
49
|
+
|
|
50
|
+
## Providers
|
|
51
|
+
|
|
52
|
+
RapidAPI is the default and automatically adds
|
|
53
|
+
`x-rapidapi-host: spotify81.p.rapidapi.com`:
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
spotify = SpotifyApiClient(
|
|
57
|
+
api_key="your-rapidapi-key",
|
|
58
|
+
provider="rapidapi",
|
|
59
|
+
)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The direct proxy exposes the same methods and paths. Use a key issued by the
|
|
63
|
+
direct portal:
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
spotify = SpotifyApiClient(
|
|
67
|
+
api_key="your-direct-proxy-key",
|
|
68
|
+
provider="proxy",
|
|
69
|
+
)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The API key may be omitted when `SPOTIFY_API_KEY` or `RAPIDAPI_KEY` is set.
|
|
73
|
+
|
|
74
|
+
## Pythonic and npm-compatible names
|
|
75
|
+
|
|
76
|
+
Python methods use `snake_case`, while npm-style `camelCase` aliases are also
|
|
77
|
+
available:
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
spotify.artists.top_tracks(id, market="US")
|
|
81
|
+
spotify.artists.topTracks(id, market="US") # exact npm-style alias
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Every method supports per-call `request_timeout`, `request_retries`,
|
|
85
|
+
`request_headers`, and an additional `extra_query` mapping. POST methods also
|
|
86
|
+
accept a free-form `body` mapping.
|
|
87
|
+
|
|
88
|
+
## IDs, URIs, and URLs
|
|
89
|
+
|
|
90
|
+
Spotify IDs may be supplied as bare IDs, Spotify URIs, or open.spotify.com
|
|
91
|
+
URLs. Multi-ID methods accept comma-separated strings or Python sequences.
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
from spotify_api_sdk import normalize_id, normalize_ids
|
|
95
|
+
|
|
96
|
+
normalize_id("spotify:track:0DiWol3AO6WpXZgp0goxAV")
|
|
97
|
+
normalize_ids([
|
|
98
|
+
"spotify:artist:4tZwfgrHOc3mvqYlEYSvVi",
|
|
99
|
+
"https://open.spotify.com/artist/06HL4z0CvFAxyc27GXpf02",
|
|
100
|
+
])
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Pagination
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
from spotify_api_sdk import collect
|
|
107
|
+
|
|
108
|
+
items = collect(
|
|
109
|
+
lambda **page: spotify.artists.albums(id=artist_id, **page),
|
|
110
|
+
get_items=lambda response: (
|
|
111
|
+
response.get("data", {})
|
|
112
|
+
.get("artist", {})
|
|
113
|
+
.get("discography", {})
|
|
114
|
+
.get("albums", {})
|
|
115
|
+
.get("items", [])
|
|
116
|
+
),
|
|
117
|
+
limit=50,
|
|
118
|
+
max_items=500,
|
|
119
|
+
)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Errors
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
from spotify_api_sdk import (
|
|
126
|
+
AuthError,
|
|
127
|
+
HttpError,
|
|
128
|
+
RateLimitError,
|
|
129
|
+
SpotifyApiError,
|
|
130
|
+
TimeoutError,
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
try:
|
|
134
|
+
spotify.search.search("daft punk")
|
|
135
|
+
except RateLimitError as error:
|
|
136
|
+
print(error.retry_after_ms)
|
|
137
|
+
except AuthError:
|
|
138
|
+
print("Invalid or unsubscribed API key")
|
|
139
|
+
except SpotifyApiError as error:
|
|
140
|
+
print(error.status, error.code, error.url)
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Configuration
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
spotify = SpotifyApiClient(
|
|
147
|
+
api_key="...",
|
|
148
|
+
provider="rapidapi", # rapidapi (default) | proxy
|
|
149
|
+
timeout=30,
|
|
150
|
+
retries=2,
|
|
151
|
+
retry_delay=0.5,
|
|
152
|
+
headers={"x-my-header": "value"},
|
|
153
|
+
debug=True,
|
|
154
|
+
on_request=lambda info: print("request", info["url"]),
|
|
155
|
+
on_response=lambda info: print("response", info["status"]),
|
|
156
|
+
on_retry=lambda info: print("retry", info["attempt"]),
|
|
157
|
+
)
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
The client is also a context manager:
|
|
161
|
+
|
|
162
|
+
```python
|
|
163
|
+
with SpotifyApiClient(api_key="...") as spotify:
|
|
164
|
+
markets = spotify.markets.get()
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
See [API_REFERENCE.md](./API_REFERENCE.md) for every namespace and method.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "checkleaked-spotify-api"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Typed Python SDK for the CheckLeaked Spotify Data API and RapidAPI spotify81."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [{ name = "Eduardo Airaudo", email = "airaudoeduardo@gmail.com" }]
|
|
13
|
+
keywords = [
|
|
14
|
+
"spotify",
|
|
15
|
+
"spotify-api",
|
|
16
|
+
"spotify-data",
|
|
17
|
+
"spotify81",
|
|
18
|
+
"rapidapi",
|
|
19
|
+
"checkleaked",
|
|
20
|
+
"music",
|
|
21
|
+
"lyrics",
|
|
22
|
+
"charts",
|
|
23
|
+
"concerts",
|
|
24
|
+
"sdk",
|
|
25
|
+
]
|
|
26
|
+
classifiers = [
|
|
27
|
+
"Development Status :: 5 - Production/Stable",
|
|
28
|
+
"Intended Audience :: Developers",
|
|
29
|
+
"License :: OSI Approved :: MIT License",
|
|
30
|
+
"Programming Language :: Python :: 3",
|
|
31
|
+
"Programming Language :: Python :: 3.8",
|
|
32
|
+
"Programming Language :: Python :: 3.9",
|
|
33
|
+
"Programming Language :: Python :: 3.10",
|
|
34
|
+
"Programming Language :: Python :: 3.11",
|
|
35
|
+
"Programming Language :: Python :: 3.12",
|
|
36
|
+
"Programming Language :: Python :: 3.13",
|
|
37
|
+
"Typing :: Typed",
|
|
38
|
+
]
|
|
39
|
+
dependencies = ["requests>=2.25"]
|
|
40
|
+
|
|
41
|
+
[project.optional-dependencies]
|
|
42
|
+
dev = [
|
|
43
|
+
"pytest>=7",
|
|
44
|
+
"mypy>=1.8",
|
|
45
|
+
"types-requests",
|
|
46
|
+
"build",
|
|
47
|
+
"twine",
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
[project.urls]
|
|
51
|
+
Homepage = "https://spotify-proxy.checkleaked.cc"
|
|
52
|
+
Documentation = "https://spotify-proxy.checkleaked.cc/docs"
|
|
53
|
+
Repository = "https://github.com/eduair94/checkleaked-spotify-api-python"
|
|
54
|
+
Issues = "https://github.com/eduair94/checkleaked-spotify-api-python/issues"
|
|
55
|
+
OpenAPI = "https://spotify-proxy.checkleaked.cc/openapi.json"
|
|
56
|
+
|
|
57
|
+
[tool.hatch.build.targets.wheel]
|
|
58
|
+
packages = ["src/spotify_api_sdk"]
|
|
59
|
+
|
|
60
|
+
[tool.hatch.build.targets.sdist]
|
|
61
|
+
include = [
|
|
62
|
+
"src",
|
|
63
|
+
"tests",
|
|
64
|
+
"scripts",
|
|
65
|
+
"README.md",
|
|
66
|
+
"API_REFERENCE.md",
|
|
67
|
+
"LICENSE",
|
|
68
|
+
"CHANGELOG.md",
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
[tool.pytest.ini_options]
|
|
72
|
+
testpaths = ["tests"]
|
|
73
|
+
addopts = "-q"
|
|
74
|
+
markers = [
|
|
75
|
+
"live: performs a real network request against a configured provider",
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
[tool.mypy]
|
|
79
|
+
python_version = "3.10"
|
|
80
|
+
strict = true
|
|
81
|
+
warn_return_any = false
|
|
82
|
+
files = ["src"]
|