使用服务帐户 oauth2client.client.CryptoUnavailableError 访问 Google API:没有可用的加密库 [英] Google API access using Service Account oauth2client.client.CryptoUnavailableError: No crypto library available

查看:23
本文介绍了使用服务帐户 oauth2client.client.CryptoUnavailableError 访问 Google API:没有可用的加密库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个服务帐户应用程序,以便我可以使用 Python 访问 Google Analytics api.有两件事让我感到困惑.首先,当我使用以下代码时:

I am trying to create a service account app so that I can access Google Analytics api using Python. Two things are confusing me. First, when I use the following code:

`from oauth2client.client import SignedJwtAssertionCredentials
client_email = "#####client_email#######.gserviceaccount.com"
with open("XXXXXX.p12") as f:
   private_key = f.read()
credentials = SignedJwtAssertionCredentials(client_email, private_key,'https://www.googleapis.com/auth/sqlservice.admin')`

我收到以下错误:

`oauth2client.client.CryptoUnavailableError: No crypto library available`

在做了一些研究之后,我发现这可能与向服务帐户授予应用程序域范围的权限有关.但是,当我登录到 Google Developers Console 时,我找不到安全图标或更多选项按钮.非常感谢您的任何帮助.

After doing a little research I found that this might have to do with granting the app domain-wide authority to the service account. However, when I log on to the Google Developers Console I cannot locate the security icon or the more-options button. Any help much appreciated thank you.

推荐答案

该错误可能意味着您需要 python-openssl 包.

That error probably means you need the python-openssl package.

apt-get install python-openssl

这篇关于使用服务帐户 oauth2client.client.CryptoUnavailableError 访问 Google API:没有可用的加密库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆