0

I have problem with use gspread and oauth2. I want to write some information in spreadsheets google.

    import json
    import gspread
    from oauth2client.client import SignedJwtAssertionCredentials

    json_key = json.load(open('Test-***********.json'))
    scope = ['https://spreadsheets.google.com/feeds']

    credentials = SignedJwtAssertionCredentials(json_key['client_email'], bytes(json_key['private_key'], 'utf-8'), scope)

    gc = gspread.authorize(credentials)

    wks = gc.open("Test").sheet1

When I start this program I have errors:

Traceback (most recent call last):
  File "write.py", line 10, in <module>
    gc = gspread.authorize(credentials)
  File "write.py", line 335, in authorize
    client.login()
  File "write.py", line 98, in login
    self.auth.refresh(http)
  File "\oauth2client\client.py", line 598, in refresh
    self._refresh(http.request)
  File "\oauth2client\client.py", line 769, in _refresh
    self._do_refresh_request(http_request)
  File "\oauth2client\client.py", line 795, in _do_refresh_request
    body = self._generate_refresh_request_body()
  File "\oauth2client\client.py", line 1425, in _generate_refresh_request_body
    assertion = self._generate_assertion()
  File "\oauth2client\client.py", line 1554, in _generate_assertion
    private_key, self.private_key_password), payload)
  File "\oauth2client\crypt.py", line 166, in from_string
    from OpenSSL import crypto
  File "\OpenSSL\__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "\OpenSSL\rand.py", line 11, in <module>
    from OpenSSL._util import (
  File "\OpenSSL\_util.py", line 6, in <module>
    from cryptography.hazmat.bindings.openssl.binding import Binding
ImportError: No module named 'cryptography'

How to resolve it? I use python 3.4 32-bit.

Ivan219
  • 1
  • 1
  • have you installed the module `cryptography` through `pip install cryptography`? – awbemauler Jul 30 '15 at 17:29
  • Thank for your reply, I install the module cryptography, next I install cffi, and pycparser, but I got a message: import _cffi_backend as backend ImportError: No module named '_cffi_backend', And I use Windows. how to install? , because I transfer module folder to file folder, no python. – Ivan219 Jul 30 '15 at 18:43

0 Answers0