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

user3277225 picture user3277225 · Dec 5, 2014 · Viewed 14.8k times · Source

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.

Answer

shacker picture shacker · Apr 24, 2015

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

pip install PyOpenSSL

pip freeze says I have version 0.15.1