在Spotify API中处理404错误-Python
我正在使用一个拥有5000张Spotify专辑的数据集,我的目标是从所有专辑中获取功能。我遇到了以下问题:文件的某些行返回下面的错误:
HTTP Error for GET to https://api.spotify.com/v1/search with Params: {'q': 'album:ニンテンドーDS ポケモン ダイヤモンド&パール スーパーミュージックコレクション (Nintendo DS Pokémon Diamond & Pearl Super Music Collection)', 'limit': 10, 'offset': 0, 'type': 'album', 'market': None} returned 404 due to Not found.
我正在寻找“懒惰”解决方案,有某种方法可以跳过错误?我试图使用除块以外的块:
for album_1 in all_albums:
try:
rows.append(merge_info(album_1))
except:
continue
但是它不起作用。
任何帮助都将受到赞赏!
I'm working with a dataset that has 5000 Spotify albums, my goal is to get the features from all albums. I'm having the following problem: Some lines of the file return an error like the one below:
HTTP Error for GET to https://api.spotify.com/v1/search with Params: {'q': 'album:ニンテンドーDS ポケモン ダイヤモンド&パール スーパーミュージックコレクション (Nintendo DS Pokémon Diamond & Pearl Super Music Collection)', 'limit': 10, 'offset': 0, 'type': 'album', 'market': None} returned 404 due to Not found.
I'm searching for a "lazy" solution to this, there is some way to skip the error? I tried to use the except block:
for album_1 in all_albums:
try:
rows.append(merge_info(album_1))
except:
continue
But it doesn't work.
Any help is appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论