I was trying to run the line
credentials = SignedJwtAssertionCredentials(client_email, private_key, 'https://www.googleapis.com/auth/compute')
on my Windows laptop, but got the error
No crypto library available
Googling the error, I find out that I had to install pyOpenSSL, that I did:
>>> import ssl
>>> ssl.OPENSSL_VERSION
'OpenSSL 0.9.8y 5 Feb 2013'
But, it did not fix the error above, so I looked in more details to the error message:
Traceback (most recent call last):
File "<pyshell#35>", line 1, in <module>
credentials = SignedJwtAssertionCredentials(client_email, private_key, 'https://www.googleapis.com/auth/compute')
File "C:\python27_x64\lib\site-packages\oauth2client-1.4.7-py2.7.egg\oauth2client\util.py", line 137, in positional_wrapper
return wrapped(*args, **kwargs)
File "C:\python27_x64\lib\site-packages\oauth2client-1.4.7-py2.7.egg\oauth2client\client.py", line 1458, in __init__
_RequireCryptoOrDie()
File "C:\python27_x64\lib\site-packages\oauth2client-1.4.7-py2.7.egg\oauth2client\client.py", line 1412, in _RequireCryptoOrDie
raise CryptoUnavailableError('No crypto library available')
CryptoUnavailableError: No crypto library available
_RequireCryptoOrDie()
Then, I looked up the definition of this function that I found from line 1404:
def _RequireCryptoOrDie():
"""Ensure we have a crypto library, or throw CryptoUnavailableError.
The oauth2client.crypt module requires either PyCrypto or PyOpenSSL
to be available in order to function, but these are optional
dependencies.
"""
if not HAS_CRYPTO:
raise CryptoUnavailableError('No crypto library available')
Then, I looked up for the "definition" of HAS_CRYPTO that I found from line 44:
HAS_CRYPTO = False
try:
from oauth2client import crypt
HAS_CRYPTO = True
With that information, I tried to interactively import the "crypt" module:
>>> import crypt
Traceback (most recent call last):
File "<pyshell#41>", line 1, in <module>
import crypt
ImportError: No module named crypt
As a conclusion, if the "Google APIs Client Library for Python" requires the "crypt" module, and the "crypt" module cannot be used/installed on Windows OS, then the "Google APIs Client Library for Python" cannot be used on Windows OS, which is in contradiction with the documentation at
https://developers.google.com/api-client-library/python/start/installation, which includes Windows as supported OS.
Have I missed something? I am just starting playing with Python... Or, should the "client.py" be adapted?
Many thanks in advance for your help!