小编you*_*res的帖子

API 获取中未处理的拒绝类型错误

我在使用 Spotify Web 应用程序时遇到了奇怪的错误。我尝试将播放列表保存到我的帐户,该帐户必须idhttps://api.spotify.com/v1/me端点获取元素,然后将播放列表应用到您的帐户。除此之外,一切看起来都很好,除了提取到该端点时会抛出错误:

Spotify.js:81 Uncaught (in promise) TypeError: Failed to execute 'fetch' on 'Window': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)'

我以前从未见过此错误,并且不确定为什么会发生。方法findUserId是:

findUserId() {
  if(accessToken === undefined) {
    this.getAccessToken();
  }
  console.log(accessToken);
  let userId;
  fetch(`https://api.spotify.com/v1/me`, {headers: `Bearer ${accessToken}`}
    ).then(response => {return response.json()}
    ).then(jsonResponse => {
        userId = jsonResponse.id;
    });
  console.log(userId);
  return userId;
}
Run Code Online (Sandbox Code Playgroud)

javascript fetch

5
推荐指数
1
解决办法
1万
查看次数

检查文本文件是否有另一行 Python

我正在编写一个脚本来将文本文件解析为自己的电子表格,为此我需要通读它们。问题是找出何时停止。Java在阅读时附加了一个方法调用hasNext(),或者hasNextLine()我想知道Python中是否有类似的方法?由于某种原因我在任何地方都找不到这个。

前任:

open(f) as file:
    file.readline()
    nextLine = true
    while nextLine:
        file.readline()
        Do stuff
        if not file.hasNextLine():
            nextLine = false
Run Code Online (Sandbox Code Playgroud)

python

5
推荐指数
2
解决办法
3万
查看次数

如何在git中恢复提交

我在一个个人项目中整天都在做一些事情,然后把它交给了一个分支机构.然后我意识到我将承诺掌握并创建一个新的分支推送到,并且git切换到该分支.之后我换回来但找不到我的提交.在创建分支之前有没有办法恢复提交?它恢复了我的很多工作.

git git-commit git-branch

0
推荐指数
1
解决办法
76
查看次数

标签 统计

fetch ×1

git ×1

git-branch ×1

git-commit ×1

javascript ×1

python ×1