小编use*_*941的帖子

我似乎无法让 google.cloud.texttospeech 工作

我使用 Python 3.8,我复制粘贴了这段代码作为测试。

from google.cloud import texttospeech

# Instantiates a client
client = texttospeech.TextToSpeechClient()

# Set the text input to be synthesized
synthesis_input = texttospeech.SynthesisInput(text="Hello, World!")

# Build the voice request, select the language code ("en-US") and the ssml
# voice gender ("neutral")
voice = texttospeech.VoiceSelectionParams(
    language_code="en-US", ssml_gender=texttospeech.SsmlVoiceGender.NEUTRAL
)

# Select the type of audio file you want returned
audio_config = texttospeech.AudioConfig(
    audio_encoding=texttospeech.AudioEncoding.MP3
)

# Perform the text-to-speech request on the text input with the selected
# voice parameters and …
Run Code Online (Sandbox Code Playgroud)

python-3.x google-cloud-platform

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

有没有办法阻止 401 未经授权登录控制台?

我在 Vue.js 中有一个函数,它将数据发送到后端以让用户登录。但是,如果用户不存在,它会返回 401 未经授权。这对我来说没问题,问题是它似乎总是登录到控制台。我已经知道我可以处理它,但它总是记录到控制台。有没有办法阻止 Web 控制台记录未经授权的 401?

我的功能

  this.$store
          .dispatch("userLogin", {
            username: this.username,
            password: this.password,
          })
          .then((response) => {
            switch (response.status) {
              case 401:
                //I know unauthorized attempt can be handled here.
                break;
            }
            this.$router.push({ name: "Admin" });
          })
          .catch(function (error) {
            console.log(error.response.data);
          });
      }
Run Code Online (Sandbox Code Playgroud)

我想阻止它被记录。

https://ibb.co/6vNdYrw

javascript vue.js

2
推荐指数
1
解决办法
1795
查看次数