谷歌正式推出Python版Google API客户端库

谷歌的开发者团队今天在博客中宣布,Google API的Python客户端库已经脱离了测试阶段,已经正式发布。其中包含了:

1. google-api-python-client:用于访问Google API的核心Python库
2. oauth2client:针对OAuth 2.0的Python客户端库
3. 使用google-api-python-client和oauth2client构建的示例应用程序

谷歌称,如果开发者想使用Google API构建一个Python应用程序,那么强烈建议使用该客户端库,因为该库可以帮助开发者轻松调用任何RESTful Google API,并抓取返回的数据。此外,该库还可以帮助开发者处理OAuth 2.0验证协议以及所有的错误,而无需写额外的代码。

文档: https://developers.google.com/ap ... n/start/get_started

下载: https://code.google.com/p/google-api-python-client/

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/301743/viewspace-743723/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/301743/viewspace-743723/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Google 提供了 Google Cloud Speech-to-Text API,可以用于语音识别。你可以使用 Python 来调用该 API 来实现语音识别。 首先,你需要创建一个 Google Cloud 账户并启用 Cloud Speech-to-Text API。然后,你需要安装 Google Cloud SDK 和 Google Cloud Python 客户。 安装完客户后,你可以使用以下代码来调用 Google Cloud Speech-to-Text API: ```python from google.cloud import speech_v1 from google.cloud.speech_v1 import enums import io client = speech_v1.SpeechClient() # The name of the audio file to transcribe file_name = 'path/to/audio/file' # Loads the audio into memory with io.open(file_name, 'rb') as audio_file: content = audio_file.read() audio = speech_v1.types.RecognitionAudio(content=content) config = speech_v1.types.RecognitionConfig( encoding=enums.RecognitionConfig.AudioEncoding.LINEAR16, sample_rate_hertz=16000, language_code='en-US') # Detects speech in the audio file response = client.recognize(config, audio) for result in response.results: print('Transcript: {}'.format(result.alternatives[0].transcript)) ``` 在代码中,你需要将 `file_name` 替换为你要识别的音频文件的路径。除此之外,你还可以根据需要修改 `sample_rate_hertz`,`language_code` 等配置参数。 参考资料: - [Google Cloud Speech-to-Text API documentation](https://cloud.google.com/speech-to-text/docs) - [Google Cloud Speech-to-Text API client libraries](https://cloud.google.com/speech-to-text/docs/quickstart-client-libraries)

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值