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

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

问题描述

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

$ b $ $ $ $ $ $ $ $ $ $ $ $'$'$'$'$'$'$'$'$'$'$' ##### client_email #######。gserviceaccount.com
打开(XXXXXX.p12)作为f:
private_key = f.read()
凭证= SignedJwtAssertionCredentials(client_email,private_key,'https://www.googleapis.com/auth/sqlservice.admin')`

我得到以下错误:

 `oauth2client.client.CryptoUnavailableError:没有可用的加密库`

在做了一些调查后,我发现这可能与授予应用程序域范围权限帐户。但是,当我登录Google Developers Console时,找不到安全图标或更多选项按钮。任何帮助非常感谢你。

解决方案

该错误可能意味着您需要python-openssl软件包。

  apt-get install python-openssl 


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')`

I get the following error:

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

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.

解决方案

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

apt-get install python-openssl

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

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