小编Pao*_*gVa的帖子

ValueError:客户端机密必须用于网络或已安装的应用程序

我在 Python Quickstart下运行 quickstart.py 示例代码,但出现以下错误:

ValueError:客户端机密必须用于 Web 或已安装的应用程序。

我创建了一个credentials.json具有项目所有者权限的文件。

错误发生在以下代码段中:

if os.path.exists('token.pickle'):
    with open('token.pickle', 'rb') as token:
        creds = pickle.load(token)
# If there are no (valid) credentials available, let the user log in.
if not creds or not creds.valid:
    if creds and creds.expired and creds.refresh_token:
        creds.refresh(Request())
    else:
        flow = InstalledAppFlow.from_client_secrets_file('credentials.json', SCOPES)
        creds = flow.run_local_server()
    # Save the credentials for the next run
    with open('token.pickle', 'wb') as token:
        pickle.dump(creds, token)
Run Code Online (Sandbox Code Playgroud)

我还注意到没有创建 token.pickle 文件。这是错误输出:

  File "updateSlidev01.py", line 51, in …
Run Code Online (Sandbox Code Playgroud)

python google-api google-api-python-client

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

如何让 TypeScript 知道我正在使用特定的接口?

我使用 TypeScript 并有两个接口,Interface1 或 Interface 2,例如:

export interface Interface1 {
  propA: string;
  propB: string;
}

export interface Interface12 {
  propA: string;
  propC: string;
}

Run Code Online (Sandbox Code Playgroud)

返回实现可能接口之一的对象的方法如下所示:

doSomething: (state): Interface1 | Interface2 | null => {
      if (state === 1) {
        return ObjectImplementingInterface1;
      }
      if (state === 2) {
        return ObjectImplementingInterface2;
      }
      return null;
    }
Run Code Online (Sandbox Code Playgroud)

之后,我想使用该方法的结果并使用仅存在于 Interface2 中的属性,例如:

const varExample = this.doSomething(this.s);
      if (varExample) {
        if ('type' in varExample && varExample.type === 'Interface1') {
          this.importantResult = varExample.propA;
        }

        if ('type' in varExample …
Run Code Online (Sandbox Code Playgroud)

javascript typescript

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

公钥不可用

我正在按照以下步骤在运行Raspbian GNU7Linux 8(Jessie)的Raspberry Pi 3 Model B上安装ROS Kinetic 。

设置存储库,我得到以下输出:

Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.vAO4o1tMMY --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 0xB01FA11
Run Code Online (Sandbox Code Playgroud)

当尝试运行sudo apt-get更新时,出现此错误:

W: GPG error: http://packages.ros.org jessie InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 5523BAEEB01FA116
Run Code Online (Sandbox Code Playgroud)

有人在添加公钥时遇到问题吗?

robotics raspberry-pi ros raspbian

3
推荐指数
1
解决办法
3187
查看次数