Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google API access using Service Account oauth2client.client.CryptoUnavailableError: No crypto library available

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.

like image 329
FierceScarf Avatar asked Dec 04 '14 23:12

FierceScarf


2 Answers

This did the trick for me (without converting to PEM):

pip install PyOpenSSL

pip freeze says I have version 0.15.1

like image 153
shacker Avatar answered Sep 20 '22 20:09

shacker


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

apt-get install python-openssl
like image 31
Wraezor Sharp Avatar answered Sep 20 '22 20:09

Wraezor Sharp