在Spotify API中处理404错误-Python

发布于 2025-02-11 20:43:12 字数 597 浏览 0 评论 0原文

我正在使用一个拥有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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文